", { title: e.element.attr("title") }); return e.disabled && this._addClass(i, null, "ui-state-disabled"), this._setText(s, e.label), i.append(s).appendTo(t) }, _setText: function (t, e) { e ? t.text(e) : t.html(" ") }, _move: function (t, e) { var i, s = ".ui-menu-item"; this.isOpen ? i = this.menuItems.eq(this.focusIndex).parent("li") : (i = this.menuItems.eq(this.element[0].selectedIndex).parent("li"), s += ":not(.ui-state-disabled)"), (s = "first" === t || "last" === t ? i["first" === t ? "prevAll" : "nextAll"](s).eq(-1) : i[t + "All"](s).eq(0)).length && this.menuInstance.focus(e, s) }, _getSelectedItem: function () { return this.menuItems.eq(this.element[0].selectedIndex).parent("li") }, _toggle: function (t) { this[this.isOpen ? "close" : "open"](t) }, _setSelection: function () { var t; this.range && (window.getSelection ? ((t = window.getSelection()).removeAllRanges(), t.addRange(this.range)) : this.range.select(), this.button.trigger("focus")) }, _documentClick: { mousedown: function (t) { this.isOpen && (V(t.target).closest(".ui-selectmenu-menu, #" + V.escapeSelector(this.ids.button)).length || this.close(t)) } }, _buttonEvents: { mousedown: function () { var t; window.getSelection ? (t = window.getSelection()).rangeCount && (this.range = t.getRangeAt(0)) : this.range = document.selection.createRange() }, click: function (t) { this._setSelection(), this._toggle(t) }, keydown: function (t) { var e = !0; switch (t.keyCode) { case V.ui.keyCode.TAB: case V.ui.keyCode.ESCAPE: this.close(t), e = !1; break; case V.ui.keyCode.ENTER: this.isOpen && this._selectFocusedItem(t); break; case V.ui.keyCode.UP: t.altKey ? this._toggle(t) : this._move("prev", t); break; case V.ui.keyCode.DOWN: t.altKey ? this._toggle(t) : this._move("next", t); break; case V.ui.keyCode.SPACE: this.isOpen ? this._selectFocusedItem(t) : this._toggle(t); break; case V.ui.keyCode.LEFT: this._move("prev", t); break; case V.ui.keyCode.RIGHT: this._move("next", t); break; case V.ui.keyCode.HOME: case V.ui.keyCode.PAGE_UP: this._move("first", t); break; case V.ui.keyCode.END: case V.ui.keyCode.PAGE_DOWN: this._move("last", t); break; default: this.menu.trigger(t), e = !1 }e && t.preventDefault() } }, _selectFocusedItem: function (t) { var e = this.menuItems.eq(this.focusIndex).parent("li"); e.hasClass("ui-state-disabled") || this._select(e.data("ui-selectmenu-item"), t) }, _select: function (t, e) { var i = this.element[0].selectedIndex; this.element[0].selectedIndex = t.index, this.buttonItem.replaceWith(this.buttonItem = this._renderButtonItem(t)), this._setAria(t), this._trigger("select", e, { item: t }), t.index !== i && this._trigger("change", e, { item: t }), this.close(e) }, _setAria: function (t) { t = this.menuItems.eq(t.index).attr("id"); this.button.attr({ "aria-labelledby": t, "aria-activedescendant": t }), this.menu.attr("aria-activedescendant", t) }, _setOption: function (t, e) { var i; "icons" === t && (i = this.button.find("span.ui-icon"), this._removeClass(i, null, this.options.icons.button)._addClass(i, null, e.button)), this._super(t, e), "appendTo" === t && this.menuWrap.appendTo(this._appendTo()), "width" === t && this._resizeButton() }, _setOptionDisabled: function (t) { this._super(t), this.menuInstance.option("disabled", t), this.button.attr("aria-disabled", t), this._toggleClass(this.button, null, "ui-state-disabled", t), this.element.prop("disabled", t), t ? (this.button.attr("tabindex", -1), this.close()) : this.button.attr("tabindex", 0) }, _appendTo: function () { var t = this.options.appendTo; return t = !(t = !(t = t && (t.jquery || t.nodeType ? V(t) : this.document.find(t).eq(0))) || !t[0] ? this.element.closest(".ui-front, dialog") : t).length ? this.document[0].body : t }, _toggleAttr: function () { this.button.attr("aria-expanded", this.isOpen), this._removeClass(this.button, "ui-selectmenu-button-" + (this.isOpen ? "closed" : "open"))._addClass(this.button, "ui-selectmenu-button-" + (this.isOpen ? "open" : "closed"))._toggleClass(this.menuWrap, "ui-selectmenu-open", null, this.isOpen), this.menu.attr("aria-hidden", !this.isOpen) }, _resizeButton: function () { var t = this.options.width; !1 !== t ? (null === t && (t = this.element.show().outerWidth(), this.element.hide()), this.button.outerWidth(t)) : this.button.css("width", "") }, _resizeMenu: function () { this.menu.outerWidth(Math.max(this.button.outerWidth(), this.menu.width("").outerWidth() + 1)) }, _getCreateOptions: function () { var t = this._super(); return t.disabled = this.element.prop("disabled"), t }, _parseOptions: function (t) { var i = this, s = []; t.each(function (t, e) { e.hidden || s.push(i._parseOption(V(e), t)) }), this.items = s }, _parseOption: function (t, e) { var i = t.parent("optgroup"); return { element: t, index: e, value: t.val(), label: t.text(), optgroup: i.attr("label") || "", disabled: i.prop("disabled") || t.prop("disabled") } }, _destroy: function () { this._unbindFormResetHandler(), this.menuWrap.remove(), this.button.remove(), this.element.show(), this.element.removeUniqueId(), this.labels.attr("for", this.ids.element) } }]), V.widget("ui.slider", V.ui.mouse, { version: "1.13.2", widgetEventPrefix: "slide", options: { animate: !1, classes: { "ui-slider": "ui-corner-all", "ui-slider-handle": "ui-corner-all", "ui-slider-range": "ui-corner-all ui-widget-header" }, distance: 0, max: 100, min: 0, orientation: "horizontal", range: !1, step: 1, value: 0, values: null, change: null, slide: null, start: null, stop: null }, numPages: 5, _create: function () { this._keySliding = !1, this._mouseSliding = !1, this._animateOff = !0, this._handleIndex = null, this._detectOrientation(), this._mouseInit(), this._calculateNewMax(), this._addClass("ui-slider ui-slider-" + this.orientation, "ui-widget ui-widget-content"), this._refresh(), this._animateOff = !1 }, _refresh: function () { this._createRange(), this._createHandles(), this._setupEvents(), this._refreshValue() }, _createHandles: function () { var t, e = this.options, i = this.element.find(".ui-slider-handle"), s = [], n = e.values && e.values.length || 1; for (i.length > n && (i.slice(n).remove(), i = i.slice(0, n)), t = i.length; t < n; t++)s.push("
"); this.handles = i.add(V(s.join("")).appendTo(this.element)), this._addClass(this.handles, "ui-slider-handle", "ui-state-default"), this.handle = this.handles.eq(0), this.handles.each(function (t) { V(this).data("ui-slider-handle-index", t).attr("tabIndex", 0) }) }, _createRange: function () { var t = this.options; t.range ? (!0 === t.range && (t.values ? t.values.length && 2 !== t.values.length ? t.values = [t.values[0], t.values[0]] : Array.isArray(t.values) && (t.values = t.values.slice(0)) : t.values = [this._valueMin(), this._valueMin()]), this.range && this.range.length ? (this._removeClass(this.range, "ui-slider-range-min ui-slider-range-max"), this.range.css({ left: "", bottom: "" })) : (this.range = V("
").appendTo(this.element), this._addClass(this.range, "ui-slider-range")), "min" !== t.range && "max" !== t.range || this._addClass(this.range, "ui-slider-range-" + t.range)) : (this.range && this.range.remove(), this.range = null) }, _setupEvents: function () { this._off(this.handles), this._on(this.handles, this._handleEvents), this._hoverable(this.handles), this._focusable(this.handles) }, _destroy: function () { this.handles.remove(), this.range && this.range.remove(), this._mouseDestroy() }, _mouseCapture: function (t) { var i, s, n, o, e, a, r = this, l = this.options; return !l.disabled && (this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }, this.elementOffset = this.element.offset(), a = { x: t.pageX, y: t.pageY }, i = this._normValueFromMouse(a), s = this._valueMax() - this._valueMin() + 1, this.handles.each(function (t) { var e = Math.abs(i - r.values(t)); (e < s || s === e && (t === r._lastChangedValue || r.values(t) === l.min)) && (s = e, n = V(this), o = t) }), !1 !== this._start(t, o) && (this._mouseSliding = !0, this._handleIndex = o, this._addClass(n, null, "ui-state-active"), n.trigger("focus"), e = n.offset(), a = !V(t.target).parents().addBack().is(".ui-slider-handle"), this._clickOffset = a ? { left: 0, top: 0 } : { left: t.pageX - e.left - n.width() / 2, top: t.pageY - e.top - n.height() / 2 - (parseInt(n.css("borderTopWidth"), 10) || 0) - (parseInt(n.css("borderBottomWidth"), 10) || 0) + (parseInt(n.css("marginTop"), 10) || 0) }, this.handles.hasClass("ui-state-hover") || this._slide(t, o, i), this._animateOff = !0)) }, _mouseStart: function () { return !0 }, _mouseDrag: function (t) { var e = { x: t.pageX, y: t.pageY }, e = this._normValueFromMouse(e); return this._slide(t, this._handleIndex, e), !1 }, _mouseStop: function (t) { return this._removeClass(this.handles, null, "ui-state-active"), this._mouseSliding = !1, this._stop(t, this._handleIndex), this._change(t, this._handleIndex), this._handleIndex = null, this._clickOffset = null, this._animateOff = !1 }, _detectOrientation: function () { this.orientation = "vertical" === this.options.orientation ? "vertical" : "horizontal" }, _normValueFromMouse: function (t) { var e, t = "horizontal" === this.orientation ? (e = this.elementSize.width, t.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0)) : (e = this.elementSize.height, t.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)), t = t / e; return (t = 1 < t ? 1 : t) < 0 && (t = 0), "vertical" === this.orientation && (t = 1 - t), e = this._valueMax() - this._valueMin(), e = this._valueMin() + t * e, this._trimAlignValue(e) }, _uiHash: function (t, e, i) { var s = { handle: this.handles[t], handleIndex: t, value: void 0 !== e ? e : this.value() }; return this._hasMultipleValues() && (s.value = void 0 !== e ? e : this.values(t), s.values = i || this.values()), s }, _hasMultipleValues: function () { return this.options.values && this.options.values.length }, _start: function (t, e) { return this._trigger("start", t, this._uiHash(e)) }, _slide: function (t, e, i) { var s, n = this.value(), o = this.values(); this._hasMultipleValues() && (s = this.values(e ? 0 : 1), n = this.values(e), 2 === this.options.values.length && !0 === this.options.range && (i = 0 === e ? Math.min(s, i) : Math.max(s, i)), o[e] = i), i !== n && !1 !== this._trigger("slide", t, this._uiHash(e, i, o)) && (this._hasMultipleValues() ? this.values(e, i) : this.value(i)) }, _stop: function (t, e) { this._trigger("stop", t, this._uiHash(e)) }, _change: function (t, e) { this._keySliding || this._mouseSliding || (this._lastChangedValue = e, this._trigger("change", t, this._uiHash(e))) }, value: function (t) { return arguments.length ? (this.options.value = this._trimAlignValue(t), this._refreshValue(), void this._change(null, 0)) : this._value() }, values: function (t, e) { var i, s, n; if (1 < arguments.length) return this.options.values[t] = this._trimAlignValue(e), this._refreshValue(), void this._change(null, t); if (!arguments.length) return this._values(); if (!Array.isArray(t)) return this._hasMultipleValues() ? this._values(t) : this.value(); for (i = this.options.values, s = t, n = 0; n < i.length; n += 1)i[n] = this._trimAlignValue(s[n]), this._change(null, n); this._refreshValue() }, _setOption: function (t, e) { var i, s = 0; switch ("range" === t && !0 === this.options.range && ("min" === e ? (this.options.value = this._values(0), this.options.values = null) : "max" === e && (this.options.value = this._values(this.options.values.length - 1), this.options.values = null)), Array.isArray(this.options.values) && (s = this.options.values.length), this._super(t, e), t) { case "orientation": this._detectOrientation(), this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-" + this.orientation), this._refreshValue(), this.options.range && this._refreshRange(e), this.handles.css("horizontal" === e ? "bottom" : "left", ""); break; case "value": this._animateOff = !0, this._refreshValue(), this._change(null, 0), this._animateOff = !1; break; case "values": for (this._animateOff = !0, this._refreshValue(), i = s - 1; 0 <= i; i--)this._change(null, i); this._animateOff = !1; break; case "step": case "min": case "max": this._animateOff = !0, this._calculateNewMax(), this._refreshValue(), this._animateOff = !1; break; case "range": this._animateOff = !0, this._refresh(), this._animateOff = !1 } }, _setOptionDisabled: function (t) { this._super(t), this._toggleClass(null, "ui-state-disabled", !!t) }, _value: function () { var t = this.options.value; return t = this._trimAlignValue(t) }, _values: function (t) { var e, i; if (arguments.length) return t = this.options.values[t], t = this._trimAlignValue(t); if (this._hasMultipleValues()) { for (e = this.options.values.slice(), i = 0; i < e.length; i += 1)e[i] = this._trimAlignValue(e[i]); return e } return [] }, _trimAlignValue: function (t) { if (t <= this._valueMin()) return this._valueMin(); if (t >= this._valueMax()) return this._valueMax(); var e = 0 < this.options.step ? this.options.step : 1, i = (t - this._valueMin()) % e, t = t - i; return 2 * Math.abs(i) >= e && (t += 0 < i ? e : -e), parseFloat(t.toFixed(5)) }, _calculateNewMax: function () { var t = this.options.max, e = this._valueMin(), i = this.options.step; (t = Math.round((t - e) / i) * i + e) > this.options.max && (t -= i), this.max = parseFloat(t.toFixed(this._precision())) }, _precision: function () { var t = this._precisionOf(this.options.step); return t = null !== this.options.min ? Math.max(t, this._precisionOf(this.options.min)) : t }, _precisionOf: function (t) { var e = t.toString(), t = e.indexOf("."); return -1 === t ? 0 : e.length - t - 1 }, _valueMin: function () { return this.options.min }, _valueMax: function () { return this.max }, _refreshRange: function (t) { "vertical" === t && this.range.css({ width: "", left: "" }), "horizontal" === t && this.range.css({ height: "", bottom: "" }) }, _refreshValue: function () { var e, i, t, s, n, o = this.options.range, a = this.options, r = this, l = !this._animateOff && a.animate, h = {}; this._hasMultipleValues() ? this.handles.each(function (t) { i = (r.values(t) - r._valueMin()) / (r._valueMax() - r._valueMin()) * 100, h["horizontal" === r.orientation ? "left" : "bottom"] = i + "%", V(this).stop(1, 1)[l ? "animate" : "css"](h, a.animate), !0 === r.options.range && ("horizontal" === r.orientation ? (0 === t && r.range.stop(1, 1)[l ? "animate" : "css"]({ left: i + "%" }, a.animate), 1 === t && r.range[l ? "animate" : "css"]({ width: i - e + "%" }, { queue: !1, duration: a.animate })) : (0 === t && r.range.stop(1, 1)[l ? "animate" : "css"]({ bottom: i + "%" }, a.animate), 1 === t && r.range[l ? "animate" : "css"]({ height: i - e + "%" }, { queue: !1, duration: a.animate }))), e = i }) : (t = this.value(), s = this._valueMin(), n = this._valueMax(), i = n !== s ? (t - s) / (n - s) * 100 : 0, h["horizontal" === this.orientation ? "left" : "bottom"] = i + "%", this.handle.stop(1, 1)[l ? "animate" : "css"](h, a.animate), "min" === o && "horizontal" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ width: i + "%" }, a.animate), "max" === o && "horizontal" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ width: 100 - i + "%" }, a.animate), "min" === o && "vertical" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ height: i + "%" }, a.animate), "max" === o && "vertical" === this.orientation && this.range.stop(1, 1)[l ? "animate" : "css"]({ height: 100 - i + "%" }, a.animate)) }, _handleEvents: { keydown: function (t) { var e, i, s, n = V(t.target).data("ui-slider-handle-index"); switch (t.keyCode) { case V.ui.keyCode.HOME: case V.ui.keyCode.END: case V.ui.keyCode.PAGE_UP: case V.ui.keyCode.PAGE_DOWN: case V.ui.keyCode.UP: case V.ui.keyCode.RIGHT: case V.ui.keyCode.DOWN: case V.ui.keyCode.LEFT: if (t.preventDefault(), !this._keySliding && (this._keySliding = !0, this._addClass(V(t.target), null, "ui-state-active"), !1 === this._start(t, n))) return }switch (s = this.options.step, e = i = this._hasMultipleValues() ? this.values(n) : this.value(), t.keyCode) { case V.ui.keyCode.HOME: i = this._valueMin(); break; case V.ui.keyCode.END: i = this._valueMax(); break; case V.ui.keyCode.PAGE_UP: i = this._trimAlignValue(e + (this._valueMax() - this._valueMin()) / this.numPages); break; case V.ui.keyCode.PAGE_DOWN: i = this._trimAlignValue(e - (this._valueMax() - this._valueMin()) / this.numPages); break; case V.ui.keyCode.UP: case V.ui.keyCode.RIGHT: if (e === this._valueMax()) return; i = this._trimAlignValue(e + s); break; case V.ui.keyCode.DOWN: case V.ui.keyCode.LEFT: if (e === this._valueMin()) return; i = this._trimAlignValue(e - s) }this._slide(t, n, i) }, keyup: function (t) { var e = V(t.target).data("ui-slider-handle-index"); this._keySliding && (this._keySliding = !1, this._stop(t, e), this._change(t, e), this._removeClass(V(t.target), null, "ui-state-active")) } } }), V.widget("ui.sortable", V.ui.mouse, { version: "1.13.2", widgetEventPrefix: "sort", ready: !1, options: { appendTo: "parent", axis: !1, connectWith: !1, containment: !1, cursor: "auto", cursorAt: !1, dropOnEmpty: !0, forcePlaceholderSize: !1, forceHelperSize: !1, grid: !1, handle: !1, helper: "original", items: "> *", opacity: !1, placeholder: !1, revert: !1, scroll: !0, scrollSensitivity: 20, scrollSpeed: 20, scope: "default", tolerance: "intersect", zIndex: 1e3, activate: null, beforeStop: null, change: null, deactivate: null, out: null, over: null, receive: null, remove: null, sort: null, start: null, stop: null, update: null }, _isOverAxis: function (t, e, i) { return e <= t && t < e + i }, _isFloating: function (t) { return /left|right/.test(t.css("float")) || /inline|table-cell/.test(t.css("display")) }, _create: function () { this.containerCache = {}, this._addClass("ui-sortable"), this.refresh(), this.offset = this.element.offset(), this._mouseInit(), this._setHandleClassName(), this.ready = !0 }, _setOption: function (t, e) { this._super(t, e), "handle" === t && this._setHandleClassName() }, _setHandleClassName: function () { var t = this; this._removeClass(this.element.find(".ui-sortable-handle"), "ui-sortable-handle"), V.each(this.items, function () { t._addClass(this.instance.options.handle ? this.item.find(this.instance.options.handle) : this.item, "ui-sortable-handle") }) }, _destroy: function () { this._mouseDestroy(); for (var t = this.items.length - 1; 0 <= t; t--)this.items[t].item.removeData(this.widgetName + "-item"); return this }, _mouseCapture: function (t, e) { var i = null, s = !1, n = this; return !this.reverting && (!this.options.disabled && "static" !== this.options.type && (this._refreshItems(t), V(t.target).parents().each(function () { if (V.data(this, n.widgetName + "-item") === n) return i = V(this), !1 }), !!(i = V.data(t.target, n.widgetName + "-item") === n ? V(t.target) : i) && (!(this.options.handle && !e && (V(this.options.handle, i).find("*").addBack().each(function () { this === t.target && (s = !0) }), !s)) && (this.currentItem = i, this._removeCurrentsFromItems(), !0)))) }, _mouseStart: function (t, e, i) { var s, n, o = this.options; if ((this.currentContainer = this).refreshPositions(), this.appendTo = V("parent" !== o.appendTo ? o.appendTo : this.currentItem.parent()), this.helper = this._createHelper(t), this._cacheHelperProportions(), this._cacheMargins(), this.offset = this.currentItem.offset(), this.offset = { top: this.offset.top - this.margins.top, left: this.offset.left - this.margins.left }, V.extend(this.offset, { click: { left: t.pageX - this.offset.left, top: t.pageY - this.offset.top }, relative: this._getRelativeOffset() }), this.helper.css("position", "absolute"), this.cssPosition = this.helper.css("position"), o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt), this.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] }, this.helper[0] !== this.currentItem[0] && this.currentItem.hide(), this._createPlaceholder(), this.scrollParent = this.placeholder.scrollParent(), V.extend(this.offset, { parent: this._getParentOffset() }), o.containment && this._setContainment(), o.cursor && "auto" !== o.cursor && (n = this.document.find("body"), this.storedCursor = n.css("cursor"), n.css("cursor", o.cursor), this.storedStylesheet = V("").appendTo(n)), o.zIndex && (this.helper.css("zIndex") && (this._storedZIndex = this.helper.css("zIndex")), this.helper.css("zIndex", o.zIndex)), o.opacity && (this.helper.css("opacity") && (this._storedOpacity = this.helper.css("opacity")), this.helper.css("opacity", o.opacity)), this.scrollParent[0] !== this.document[0] && "HTML" !== this.scrollParent[0].tagName && (this.overflowOffset = this.scrollParent.offset()), this._trigger("start", t, this._uiHash()), this._preserveHelperProportions || this._cacheHelperProportions(), !i) for (s = this.containers.length - 1; 0 <= s; s--)this.containers[s]._trigger("activate", t, this._uiHash(this)); return V.ui.ddmanager && (V.ui.ddmanager.current = this), V.ui.ddmanager && !o.dropBehaviour && V.ui.ddmanager.prepareOffsets(this, t), this.dragging = !0, this._addClass(this.helper, "ui-sortable-helper"), this.helper.parent().is(this.appendTo) || (this.helper.detach().appendTo(this.appendTo), this.offset.parent = this._getParentOffset()), this.position = this.originalPosition = this._generatePosition(t), this.originalPageX = t.pageX, this.originalPageY = t.pageY, this.lastPositionAbs = this.positionAbs = this._convertPositionTo("absolute"), this._mouseDrag(t), !0 }, _scroll: function (t) { var e = this.options, i = !1; return this.scrollParent[0] !== this.document[0] && "HTML" !== this.scrollParent[0].tagName ? (this.overflowOffset.top + this.scrollParent[0].offsetHeight - t.pageY < e.scrollSensitivity ? this.scrollParent[0].scrollTop = i = this.scrollParent[0].scrollTop + e.scrollSpeed : t.pageY - this.overflowOffset.top < e.scrollSensitivity && (this.scrollParent[0].scrollTop = i = this.scrollParent[0].scrollTop - e.scrollSpeed), this.overflowOffset.left + this.scrollParent[0].offsetWidth - t.pageX < e.scrollSensitivity ? this.scrollParent[0].scrollLeft = i = this.scrollParent[0].scrollLeft + e.scrollSpeed : t.pageX - this.overflowOffset.left < e.scrollSensitivity && (this.scrollParent[0].scrollLeft = i = this.scrollParent[0].scrollLeft - e.scrollSpeed)) : (t.pageY - this.document.scrollTop() < e.scrollSensitivity ? i = this.document.scrollTop(this.document.scrollTop() - e.scrollSpeed) : this.window.height() - (t.pageY - this.document.scrollTop()) < e.scrollSensitivity && (i = this.document.scrollTop(this.document.scrollTop() + e.scrollSpeed)), t.pageX - this.document.scrollLeft() < e.scrollSensitivity ? i = this.document.scrollLeft(this.document.scrollLeft() - e.scrollSpeed) : this.window.width() - (t.pageX - this.document.scrollLeft()) < e.scrollSensitivity && (i = this.document.scrollLeft(this.document.scrollLeft() + e.scrollSpeed))), i }, _mouseDrag: function (t) { var e, i, s, n, o = this.options; for (this.position = this._generatePosition(t), this.positionAbs = this._convertPositionTo("absolute"), this.options.axis && "y" === this.options.axis || (this.helper[0].style.left = this.position.left + "px"), this.options.axis && "x" === this.options.axis || (this.helper[0].style.top = this.position.top + "px"), o.scroll && !1 !== this._scroll(t) && (this._refreshItemPositions(!0), V.ui.ddmanager && !o.dropBehaviour && V.ui.ddmanager.prepareOffsets(this, t)), this.dragDirection = { vertical: this._getDragVerticalDirection(), horizontal: this._getDragHorizontalDirection() }, e = this.items.length - 1; 0 <= e; e--)if (s = (i = this.items[e]).item[0], (n = this._intersectsWithPointer(i)) && i.instance === this.currentContainer && !(s === this.currentItem[0] || this.placeholder[1 === n ? "next" : "prev"]()[0] === s || V.contains(this.placeholder[0], s) || "semi-dynamic" === this.options.type && V.contains(this.element[0], s))) { if (this.direction = 1 === n ? "down" : "up", "pointer" !== this.options.tolerance && !this._intersectsWithSides(i)) break; this._rearrange(t, i), this._trigger("change", t, this._uiHash()); break } return this._contactContainers(t), V.ui.ddmanager && V.ui.ddmanager.drag(this, t), this._trigger("sort", t, this._uiHash()), this.lastPositionAbs = this.positionAbs, !1 }, _mouseStop: function (t, e) { var i, s, n, o; if (t) return V.ui.ddmanager && !this.options.dropBehaviour && V.ui.ddmanager.drop(this, t), this.options.revert ? (s = (i = this).placeholder.offset(), o = {}, (n = this.options.axis) && "x" !== n || (o.left = s.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft)), n && "y" !== n || (o.top = s.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop)), this.reverting = !0, V(this.helper).animate(o, parseInt(this.options.revert, 10) || 500, function () { i._clear(t) })) : this._clear(t, e), !1 }, cancel: function () { if (this.dragging) { this._mouseUp(new V.Event("mouseup", { target: null })), "original" === this.options.helper ? (this.currentItem.css(this._storedCSS), this._removeClass(this.currentItem, "ui-sortable-helper")) : this.currentItem.show(); for (var t = this.containers.length - 1; 0 <= t; t--)this.containers[t]._trigger("deactivate", null, this._uiHash(this)), this.containers[t].containerCache.over && (this.containers[t]._trigger("out", null, this._uiHash(this)), this.containers[t].containerCache.over = 0) } return this.placeholder && (this.placeholder[0].parentNode && this.placeholder[0].parentNode.removeChild(this.placeholder[0]), "original" !== this.options.helper && this.helper && this.helper[0].parentNode && this.helper.remove(), V.extend(this, { helper: null, dragging: !1, reverting: !1, _noFinalSort: null }), this.domPosition.prev ? V(this.domPosition.prev).after(this.currentItem) : V(this.domPosition.parent).prepend(this.currentItem)), this }, serialize: function (e) { var t = this._getItemsAsjQuery(e && e.connected), i = []; return e = e || {}, V(t).each(function () { var t = (V(e.item || this).attr(e.attribute || "id") || "").match(e.expression || /(.+)[\-=_](.+)/); t && i.push((e.key || t[1] + "[]") + "=" + (e.key && e.expression ? t[1] : t[2])) }), !i.length && e.key && i.push(e.key + "="), i.join("&") }, toArray: function (t) { var e = this._getItemsAsjQuery(t && t.connected), i = []; return t = t || {}, e.each(function () { i.push(V(t.item || this).attr(t.attribute || "id") || "") }), i }, _intersectsWith: function (t) { var e = this.positionAbs.left, i = e + this.helperProportions.width, s = this.positionAbs.top, n = s + this.helperProportions.height, o = t.left, a = o + t.width, r = t.top, l = r + t.height, h = this.offset.click.top, c = this.offset.click.left, h = "x" === this.options.axis || r < s + h && s + h < l, c = "y" === this.options.axis || o < e + c && e + c < a; return "pointer" === this.options.tolerance || this.options.forcePointerForContainers || "pointer" !== this.options.tolerance && this.helperProportions[this.floating ? "width" : "height"] > t[this.floating ? "width" : "height"] ? h && c : o < e + this.helperProportions.width / 2 && i - this.helperProportions.width / 2 < a && r < s + this.helperProportions.height / 2 && n - this.helperProportions.height / 2 < l }, _intersectsWithPointer: function (t) { var e = "x" === this.options.axis || this._isOverAxis(this.positionAbs.top + this.offset.click.top, t.top, t.height), t = "y" === this.options.axis || this._isOverAxis(this.positionAbs.left + this.offset.click.left, t.left, t.width); return !(!e || !t) && (e = this.dragDirection.vertical, t = this.dragDirection.horizontal, this.floating ? "right" === t || "down" === e ? 2 : 1 : e && ("down" === e ? 2 : 1)) }, _intersectsWithSides: function (t) { var e = this._isOverAxis(this.positionAbs.top + this.offset.click.top, t.top + t.height / 2, t.height), i = this._isOverAxis(this.positionAbs.left + this.offset.click.left, t.left + t.width / 2, t.width), s = this.dragDirection.vertical, t = this.dragDirection.horizontal; return this.floating && t ? "right" === t && i || "left" === t && !i : s && ("down" === s && e || "up" === s && !e) }, _getDragVerticalDirection: function () { var t = this.positionAbs.top - this.lastPositionAbs.top; return 0 != t && (0 < t ? "down" : "up") }, _getDragHorizontalDirection: function () { var t = this.positionAbs.left - this.lastPositionAbs.left; return 0 != t && (0 < t ? "right" : "left") }, refresh: function (t) { return this._refreshItems(t), this._setHandleClassName(), this.refreshPositions(), this }, _connectWith: function () { var t = this.options; return t.connectWith.constructor === String ? [t.connectWith] : t.connectWith }, _getItemsAsjQuery: function (t) { var e, i, s, n, o = [], a = [], r = this._connectWith(); if (r && t) for (e = r.length - 1; 0 <= e; e--)for (i = (s = V(r[e], this.document[0])).length - 1; 0 <= i; i--)(n = V.data(s[i], this.widgetFullName)) && n !== this && !n.options.disabled && a.push(["function" == typeof n.options.items ? n.options.items.call(n.element) : V(n.options.items, n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), n]); function l() { o.push(this) } for (a.push(["function" == typeof this.options.items ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : V(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]), e = a.length - 1; 0 <= e; e--)a[e][0].each(l); return V(o) }, _removeCurrentsFromItems: function () { var i = this.currentItem.find(":data(" + this.widgetName + "-item)"); this.items = V.grep(this.items, function (t) { for (var e = 0; e < i.length; e++)if (i[e] === t.item[0]) return !1; return !0 }) }, _refreshItems: function (t) { this.items = [], this.containers = [this]; var e, i, s, n, o, a, r, l, h = this.items, c = [["function" == typeof this.options.items ? this.options.items.call(this.element[0], t, { item: this.currentItem }) : V(this.options.items, this.element), this]], u = this._connectWith(); if (u && this.ready) for (e = u.length - 1; 0 <= e; e--)for (i = (s = V(u[e], this.document[0])).length - 1; 0 <= i; i--)(n = V.data(s[i], this.widgetFullName)) && n !== this && !n.options.disabled && (c.push(["function" == typeof n.options.items ? n.options.items.call(n.element[0], t, { item: this.currentItem }) : V(n.options.items, n.element), n]), this.containers.push(n)); for (e = c.length - 1; 0 <= e; e--)for (o = c[e][1], l = (a = c[e][i = 0]).length; i < l; i++)(r = V(a[i])).data(this.widgetName + "-item", o), h.push({ item: r, instance: o, width: 0, height: 0, left: 0, top: 0 }) }, _refreshItemPositions: function (t) { for (var e, i, s = this.items.length - 1; 0 <= s; s--)e = this.items[s], this.currentContainer && e.instance !== this.currentContainer && e.item[0] !== this.currentItem[0] || (i = this.options.toleranceElement ? V(this.options.toleranceElement, e.item) : e.item, t || (e.width = i.outerWidth(), e.height = i.outerHeight()), i = i.offset(), e.left = i.left, e.top = i.top) }, refreshPositions: function (t) { var e, i; if (this.floating = !!this.items.length && ("x" === this.options.axis || this._isFloating(this.items[0].item)), this.offsetParent && this.helper && (this.offset.parent = this._getParentOffset()), this._refreshItemPositions(t), this.options.custom && this.options.custom.refreshContainers) this.options.custom.refreshContainers.call(this); else for (e = this.containers.length - 1; 0 <= e; e--)i = this.containers[e].element.offset(), this.containers[e].containerCache.left = i.left, this.containers[e].containerCache.top = i.top, this.containers[e].containerCache.width = this.containers[e].element.outerWidth(), this.containers[e].containerCache.height = this.containers[e].element.outerHeight(); return this }, _createPlaceholder: function (i) { var s, n, o = (i = i || this).options; o.placeholder && o.placeholder.constructor !== String || (s = o.placeholder, n = i.currentItem[0].nodeName.toLowerCase(), o.placeholder = { element: function () { var t = V("<" + n + ">", i.document[0]); return i._addClass(t, "ui-sortable-placeholder", s || i.currentItem[0].className)._removeClass(t, "ui-sortable-helper"), "tbody" === n ? i._createTrPlaceholder(i.currentItem.find("tr").eq(0), V("
", i.document[0]).appendTo(t)) : "tr" === n ? i._createTrPlaceholder(i.currentItem, t) : "img" === n && t.attr("src", i.currentItem.attr("src")), s || t.css("visibility", "hidden"), t }, update: function (t, e) { s && !o.forcePlaceholderSize || (e.height() && (!o.forcePlaceholderSize || "tbody" !== n && "tr" !== n) || e.height(i.currentItem.innerHeight() - parseInt(i.currentItem.css("paddingTop") || 0, 10) - parseInt(i.currentItem.css("paddingBottom") || 0, 10)), e.width() || e.width(i.currentItem.innerWidth() - parseInt(i.currentItem.css("paddingLeft") || 0, 10) - parseInt(i.currentItem.css("paddingRight") || 0, 10))) } }), i.placeholder = V(o.placeholder.element.call(i.element, i.currentItem)), i.currentItem.after(i.placeholder), o.placeholder.update(i, i.placeholder) }, _createTrPlaceholder: function (t, e) { var i = this; t.children().each(function () { V(" ", i.document[0]).attr("colspan", V(this).attr("colspan") || 1).appendTo(e) }) }, _contactContainers: function (t) { for (var e, i, s, n, o, a, r, l, h, c = null, u = null, d = this.containers.length - 1; 0 <= d; d--)V.contains(this.currentItem[0], this.containers[d].element[0]) || (this._intersectsWith(this.containers[d].containerCache) ? c && V.contains(this.containers[d].element[0], c.element[0]) || (c = this.containers[d], u = d) : this.containers[d].containerCache.over && (this.containers[d]._trigger("out", t, this._uiHash(this)), this.containers[d].containerCache.over = 0)); if (c) if (1 === this.containers.length) this.containers[u].containerCache.over || (this.containers[u]._trigger("over", t, this._uiHash(this)), this.containers[u].containerCache.over = 1); else { for (i = 1e4, s = null, n = (l = c.floating || this._isFloating(this.currentItem)) ? "left" : "top", o = l ? "width" : "height", h = l ? "pageX" : "pageY", e = this.items.length - 1; 0 <= e; e--)V.contains(this.containers[u].element[0], this.items[e].item[0]) && this.items[e].item[0] !== this.currentItem[0] && (a = this.items[e].item.offset()[n], r = !1, t[h] - a > this.items[e][o] / 2 && (r = !0), Math.abs(t[h] - a) < i && (i = Math.abs(t[h] - a), s = this.items[e], this.direction = r ? "up" : "down")); (s || this.options.dropOnEmpty) && (this.currentContainer !== this.containers[u] ? (s ? this._rearrange(t, s, null, !0) : this._rearrange(t, null, this.containers[u].element, !0), this._trigger("change", t, this._uiHash()), this.containers[u]._trigger("change", t, this._uiHash(this)), this.currentContainer = this.containers[u], this.options.placeholder.update(this.currentContainer, this.placeholder), this.scrollParent = this.placeholder.scrollParent(), this.scrollParent[0] !== this.document[0] && "HTML" !== this.scrollParent[0].tagName && (this.overflowOffset = this.scrollParent.offset()), this.containers[u]._trigger("over", t, this._uiHash(this)), this.containers[u].containerCache.over = 1) : this.currentContainer.containerCache.over || (this.containers[u]._trigger("over", t, this._uiHash()), this.currentContainer.containerCache.over = 1)) } }, _createHelper: function (t) { var e = this.options, t = "function" == typeof e.helper ? V(e.helper.apply(this.element[0], [t, this.currentItem])) : "clone" === e.helper ? this.currentItem.clone() : this.currentItem; return t.parents("body").length || this.appendTo[0].appendChild(t[0]), t[0] === this.currentItem[0] && (this._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css("position"), top: this.currentItem.css("top"), left: this.currentItem.css("left") }), t[0].style.width && !e.forceHelperSize || t.width(this.currentItem.width()), t[0].style.height && !e.forceHelperSize || t.height(this.currentItem.height()), t }, _adjustOffsetFromHelper: function (t) { "string" == typeof t && (t = t.split(" ")), "left" in (t = Array.isArray(t) ? { left: +t[0], top: +t[1] || 0 } : t) && (this.offset.click.left = t.left + this.margins.left), "right" in t && (this.offset.click.left = this.helperProportions.width - t.right + this.margins.left), "top" in t && (this.offset.click.top = t.top + this.margins.top), "bottom" in t && (this.offset.click.top = this.helperProportions.height - t.bottom + this.margins.top) }, _getParentOffset: function () { this.offsetParent = this.helper.offsetParent(); var t = this.offsetParent.offset(); return "absolute" === this.cssPosition && this.scrollParent[0] !== this.document[0] && V.contains(this.scrollParent[0], this.offsetParent[0]) && (t.left += this.scrollParent.scrollLeft(), t.top += this.scrollParent.scrollTop()), { top: (t = this.offsetParent[0] === this.document[0].body || this.offsetParent[0].tagName && "html" === this.offsetParent[0].tagName.toLowerCase() && V.ui.ie ? { top: 0, left: 0 } : t).top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), left: t.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) } }, _getRelativeOffset: function () { if ("relative" !== this.cssPosition) return { top: 0, left: 0 }; var t = this.currentItem.position(); return { top: t.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), left: t.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft() } }, _cacheMargins: function () { this.margins = { left: parseInt(this.currentItem.css("marginLeft"), 10) || 0, top: parseInt(this.currentItem.css("marginTop"), 10) || 0 } }, _cacheHelperProportions: function () { this.helperProportions = { width: this.helper.outerWidth(), height: this.helper.outerHeight() } }, _setContainment: function () { var t, e, i = this.options; "parent" === i.containment && (i.containment = this.helper[0].parentNode), "document" !== i.containment && "window" !== i.containment || (this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, "document" === i.containment ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, ("document" === i.containment ? this.document.height() || document.body.parentNode.scrollHeight : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]), /^(document|window|parent)$/.test(i.containment) || (t = V(i.containment)[0], e = V(i.containment).offset(), i = "hidden" !== V(t).css("overflow"), this.containment = [e.left + (parseInt(V(t).css("borderLeftWidth"), 10) || 0) + (parseInt(V(t).css("paddingLeft"), 10) || 0) - this.margins.left, e.top + (parseInt(V(t).css("borderTopWidth"), 10) || 0) + (parseInt(V(t).css("paddingTop"), 10) || 0) - this.margins.top, e.left + (i ? Math.max(t.scrollWidth, t.offsetWidth) : t.offsetWidth) - (parseInt(V(t).css("borderLeftWidth"), 10) || 0) - (parseInt(V(t).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, e.top + (i ? Math.max(t.scrollHeight, t.offsetHeight) : t.offsetHeight) - (parseInt(V(t).css("borderTopWidth"), 10) || 0) - (parseInt(V(t).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]) }, _convertPositionTo: function (t, e) { e = e || this.position; var i = "absolute" === t ? 1 : -1, s = "absolute" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && V.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, t = /(html|body)/i.test(s[0].tagName); return { top: e.top + this.offset.relative.top * i + this.offset.parent.top * i - ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : t ? 0 : s.scrollTop()) * i, left: e.left + this.offset.relative.left * i + this.offset.parent.left * i - ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : t ? 0 : s.scrollLeft()) * i } }, _generatePosition: function (t) { var e = this.options, i = t.pageX, s = t.pageY, n = "absolute" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && V.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, o = /(html|body)/i.test(n[0].tagName); return "relative" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0] || (this.offset.relative = this._getRelativeOffset()), this.originalPosition && (this.containment && (t.pageX - this.offset.click.left < this.containment[0] && (i = this.containment[0] + this.offset.click.left), t.pageY - this.offset.click.top < this.containment[1] && (s = this.containment[1] + this.offset.click.top), t.pageX - this.offset.click.left > this.containment[2] && (i = this.containment[2] + this.offset.click.left), t.pageY - this.offset.click.top > this.containment[3] && (s = this.containment[3] + this.offset.click.top)), e.grid && (t = this.originalPageY + Math.round((s - this.originalPageY) / e.grid[1]) * e.grid[1], s = !this.containment || t - this.offset.click.top >= this.containment[1] && t - this.offset.click.top <= this.containment[3] ? t : t - this.offset.click.top >= this.containment[1] ? t - e.grid[1] : t + e.grid[1], t = this.originalPageX + Math.round((i - this.originalPageX) / e.grid[0]) * e.grid[0], i = !this.containment || t - this.offset.click.left >= this.containment[0] && t - this.offset.click.left <= this.containment[2] ? t : t - this.offset.click.left >= this.containment[0] ? t - e.grid[0] : t + e.grid[0])), { top: s - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : o ? 0 : n.scrollTop()), left: i - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : o ? 0 : n.scrollLeft()) } }, _rearrange: function (t, e, i, s) { i ? i[0].appendChild(this.placeholder[0]) : e.item[0].parentNode.insertBefore(this.placeholder[0], "down" === this.direction ? e.item[0] : e.item[0].nextSibling), this.counter = this.counter ? ++this.counter : 1; var n = this.counter; this._delay(function () { n === this.counter && this.refreshPositions(!s) }) }, _clear: function (t, e) { this.reverting = !1; var i, s = []; if (!this._noFinalSort && this.currentItem.parent().length && this.placeholder.before(this.currentItem), this._noFinalSort = null, this.helper[0] === this.currentItem[0]) { for (i in this._storedCSS) "auto" !== this._storedCSS[i] && "static" !== this._storedCSS[i] || (this._storedCSS[i] = ""); this.currentItem.css(this._storedCSS), this._removeClass(this.currentItem, "ui-sortable-helper") } else this.currentItem.show(); function n(e, i, s) { return function (t) { s._trigger(e, t, i._uiHash(i)) } } for (this.fromOutside && !e && s.push(function (t) { this._trigger("receive", t, this._uiHash(this.fromOutside)) }), !this.fromOutside && this.domPosition.prev === this.currentItem.prev().not(".ui-sortable-helper")[0] && this.domPosition.parent === this.currentItem.parent()[0] || e || s.push(function (t) { this._trigger("update", t, this._uiHash()) }), this !== this.currentContainer && (e || (s.push(function (t) { this._trigger("remove", t, this._uiHash()) }), s.push(function (e) { return function (t) { e._trigger("receive", t, this._uiHash(this)) } }.call(this, this.currentContainer)), s.push(function (e) { return function (t) { e._trigger("update", t, this._uiHash(this)) } }.call(this, this.currentContainer)))), i = this.containers.length - 1; 0 <= i; i--)e || s.push(n("deactivate", this, this.containers[i])), this.containers[i].containerCache.over && (s.push(n("out", this, this.containers[i])), this.containers[i].containerCache.over = 0); if (this.storedCursor && (this.document.find("body").css("cursor", this.storedCursor), this.storedStylesheet.remove()), this._storedOpacity && this.helper.css("opacity", this._storedOpacity), this._storedZIndex && this.helper.css("zIndex", "auto" === this._storedZIndex ? "" : this._storedZIndex), this.dragging = !1, e || this._trigger("beforeStop", t, this._uiHash()), this.placeholder[0].parentNode.removeChild(this.placeholder[0]), this.cancelHelperRemoval || (this.helper[0] !== this.currentItem[0] && this.helper.remove(), this.helper = null), !e) { for (i = 0; i < s.length; i++)s[i].call(this, t); this._trigger("stop", t, this._uiHash()) } return this.fromOutside = !1, !this.cancelHelperRemoval }, _trigger: function () { !1 === V.Widget.prototype._trigger.apply(this, arguments) && this.cancel() }, _uiHash: function (t) { var e = t || this; return { helper: e.helper, placeholder: e.placeholder || V([]), position: e.position, originalPosition: e.originalPosition, offset: e.positionAbs, item: e.currentItem, sender: t ? t.element : null } } }); function ht(e) { return function () { var t = this.element.val(); e.apply(this, arguments), this._refresh(), t !== this.element.val() && this._trigger("change") } } V.widget("ui.spinner", { version: "1.13.2", defaultElement: " ", widgetEventPrefix: "spin", options: { classes: { "ui-spinner": "ui-corner-all", "ui-spinner-down": "ui-corner-br", "ui-spinner-up": "ui-corner-tr" }, culture: null, icons: { down: "ui-icon-triangle-1-s", up: "ui-icon-triangle-1-n" }, incremental: !0, max: null, min: null, numberFormat: null, page: 10, step: 1, change: null, spin: null, start: null, stop: null }, _create: function () { this._setOption("max", this.options.max), this._setOption("min", this.options.min), this._setOption("step", this.options.step), "" !== this.value() && this._value(this.element.val(), !0), this._draw(), this._on(this._events), this._refresh(), this._on(this.window, { beforeunload: function () { this.element.removeAttr("autocomplete") } }) }, _getCreateOptions: function () { var s = this._super(), n = this.element; return V.each(["min", "max", "step"], function (t, e) { var i = n.attr(e); null != i && i.length && (s[e] = i) }), s }, _events: { keydown: function (t) { this._start(t) && this._keydown(t) && t.preventDefault() }, keyup: "_stop", focus: function () { this.previous = this.element.val() }, blur: function (t) { this.cancelBlur ? delete this.cancelBlur : (this._stop(), this._refresh(), this.previous !== this.element.val() && this._trigger("change", t)) }, mousewheel: function (t, e) { var i = V.ui.safeActiveElement(this.document[0]); if (this.element[0] === i && e) { if (!this.spinning && !this._start(t)) return !1; this._spin((0 < e ? 1 : -1) * this.options.step, t), clearTimeout(this.mousewheelTimer), this.mousewheelTimer = this._delay(function () { this.spinning && this._stop(t) }, 100), t.preventDefault() } }, "mousedown .ui-spinner-button": function (t) { var e; function i() { this.element[0] === V.ui.safeActiveElement(this.document[0]) || (this.element.trigger("focus"), this.previous = e, this._delay(function () { this.previous = e })) } e = this.element[0] === V.ui.safeActiveElement(this.document[0]) ? this.previous : this.element.val(), t.preventDefault(), i.call(this), this.cancelBlur = !0, this._delay(function () { delete this.cancelBlur, i.call(this) }), !1 !== this._start(t) && this._repeat(null, V(t.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, t) }, "mouseup .ui-spinner-button": "_stop", "mouseenter .ui-spinner-button": function (t) { if (V(t.currentTarget).hasClass("ui-state-active")) return !1 !== this._start(t) && void this._repeat(null, V(t.currentTarget).hasClass("ui-spinner-up") ? 1 : -1, t) }, "mouseleave .ui-spinner-button": "_stop" }, _enhance: function () { this.uiSpinner = this.element.attr("autocomplete", "off").wrap("").parent().append(" ") }, _draw: function () { this._enhance(), this._addClass(this.uiSpinner, "ui-spinner", "ui-widget ui-widget-content"), this._addClass("ui-spinner-input"), this.element.attr("role", "spinbutton"), this.buttons = this.uiSpinner.children("a").attr("tabIndex", -1).attr("aria-hidden", !0).button({ classes: { "ui-button": "" } }), this._removeClass(this.buttons, "ui-corner-all"), this._addClass(this.buttons.first(), "ui-spinner-button ui-spinner-up"), this._addClass(this.buttons.last(), "ui-spinner-button ui-spinner-down"), this.buttons.first().button({ icon: this.options.icons.up, showLabel: !1 }), this.buttons.last().button({ icon: this.options.icons.down, showLabel: !1 }), this.buttons.height() > Math.ceil(.5 * this.uiSpinner.height()) && 0 < this.uiSpinner.height() && this.uiSpinner.height(this.uiSpinner.height()) }, _keydown: function (t) { var e = this.options, i = V.ui.keyCode; switch (t.keyCode) { case i.UP: return this._repeat(null, 1, t), !0; case i.DOWN: return this._repeat(null, -1, t), !0; case i.PAGE_UP: return this._repeat(null, e.page, t), !0; case i.PAGE_DOWN: return this._repeat(null, -e.page, t), !0 }return !1 }, _start: function (t) { return !(!this.spinning && !1 === this._trigger("start", t)) && (this.counter || (this.counter = 1), this.spinning = !0) }, _repeat: function (t, e, i) { t = t || 500, clearTimeout(this.timer), this.timer = this._delay(function () { this._repeat(40, e, i) }, t), this._spin(e * this.options.step, i) }, _spin: function (t, e) { var i = this.value() || 0; this.counter || (this.counter = 1), i = this._adjustValue(i + t * this._increment(this.counter)), this.spinning && !1 === this._trigger("spin", e, { value: i }) || (this._value(i), this.counter++) }, _increment: function (t) { var e = this.options.incremental; return e ? "function" == typeof e ? e(t) : Math.floor(t * t * t / 5e4 - t * t / 500 + 17 * t / 200 + 1) : 1 }, _precision: function () { var t = this._precisionOf(this.options.step); return t = null !== this.options.min ? Math.max(t, this._precisionOf(this.options.min)) : t }, _precisionOf: function (t) { var e = t.toString(), t = e.indexOf("."); return -1 === t ? 0 : e.length - t - 1 }, _adjustValue: function (t) { var e = this.options, i = null !== e.min ? e.min : 0, s = t - i; return t = i + Math.round(s / e.step) * e.step, t = parseFloat(t.toFixed(this._precision())), null !== e.max && t > e.max ? e.max : null !== e.min && t < e.min ? e.min : t }, _stop: function (t) { this.spinning && (clearTimeout(this.timer), clearTimeout(this.mousewheelTimer), this.counter = 0, this.spinning = !1, this._trigger("stop", t)) }, _setOption: function (t, e) { var i; if ("culture" === t || "numberFormat" === t) return i = this._parse(this.element.val()), this.options[t] = e, void this.element.val(this._format(i)); "max" !== t && "min" !== t && "step" !== t || "string" == typeof e && (e = this._parse(e)), "icons" === t && (i = this.buttons.first().find(".ui-icon"), this._removeClass(i, null, this.options.icons.up), this._addClass(i, null, e.up), i = this.buttons.last().find(".ui-icon"), this._removeClass(i, null, this.options.icons.down), this._addClass(i, null, e.down)), this._super(t, e) }, _setOptionDisabled: function (t) { this._super(t), this._toggleClass(this.uiSpinner, null, "ui-state-disabled", !!t), this.element.prop("disabled", !!t), this.buttons.button(t ? "disable" : "enable") }, _setOptions: ht(function (t) { this._super(t) }), _parse: function (t) { return "" === (t = "string" == typeof t && "" !== t ? window.Globalize && this.options.numberFormat ? Globalize.parseFloat(t, 10, this.options.culture) : +t : t) || isNaN(t) ? null : t }, _format: function (t) { return "" === t ? "" : window.Globalize && this.options.numberFormat ? Globalize.format(t, this.options.numberFormat, this.options.culture) : t }, _refresh: function () { this.element.attr({ "aria-valuemin": this.options.min, "aria-valuemax": this.options.max, "aria-valuenow": this._parse(this.element.val()) }) }, isValid: function () { var t = this.value(); return null !== t && t === this._adjustValue(t) }, _value: function (t, e) { var i; "" !== t && null !== (i = this._parse(t)) && (e || (i = this._adjustValue(i)), t = this._format(i)), this.element.val(t), this._refresh() }, _destroy: function () { this.element.prop("disabled", !1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"), this.uiSpinner.replaceWith(this.element) }, stepUp: ht(function (t) { this._stepUp(t) }), _stepUp: function (t) { this._start() && (this._spin((t || 1) * this.options.step), this._stop()) }, stepDown: ht(function (t) { this._stepDown(t) }), _stepDown: function (t) { this._start() && (this._spin((t || 1) * -this.options.step), this._stop()) }, pageUp: ht(function (t) { this._stepUp((t || 1) * this.options.page) }), pageDown: ht(function (t) { this._stepDown((t || 1) * this.options.page) }), value: function (t) { if (!arguments.length) return this._parse(this.element.val()); ht(this._value).call(this, t) }, widget: function () { return this.uiSpinner } }), !1 !== V.uiBackCompat && V.widget("ui.spinner", V.ui.spinner, { _enhance: function () { this.uiSpinner = this.element.attr("autocomplete", "off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml()) }, _uiSpinnerHtml: function () { return "" }, _buttonHtml: function () { return " " } }); var ct; V.ui.spinner; V.widget("ui.tabs", { version: "1.13.2", delay: 300, options: { active: null, classes: { "ui-tabs": "ui-corner-all", "ui-tabs-nav": "ui-corner-all", "ui-tabs-panel": "ui-corner-bottom", "ui-tabs-tab": "ui-corner-top" }, collapsible: !1, event: "click", heightStyle: "content", hide: null, show: null, activate: null, beforeActivate: null, beforeLoad: null, load: null }, _isLocal: (ct = /#.*$/, function (t) { var e = t.href.replace(ct, ""), i = location.href.replace(ct, ""); try { e = decodeURIComponent(e) } catch (t) { } try { i = decodeURIComponent(i) } catch (t) { } return 1 < t.hash.length && e === i }), _create: function () { var e = this, t = this.options; this.running = !1, this._addClass("ui-tabs", "ui-widget ui-widget-content"), this._toggleClass("ui-tabs-collapsible", null, t.collapsible), this._processTabs(), t.active = this._initialActive(), Array.isArray(t.disabled) && (t.disabled = V.uniqueSort(t.disabled.concat(V.map(this.tabs.filter(".ui-state-disabled"), function (t) { return e.tabs.index(t) }))).sort()), !1 !== this.options.active && this.anchors.length ? this.active = this._findActive(t.active) : this.active = V(), this._refresh(), this.active.length && this.load(t.active) }, _initialActive: function () { var i = this.options.active, t = this.options.collapsible, s = location.hash.substring(1); return null === i && (s && this.tabs.each(function (t, e) { if (V(e).attr("aria-controls") === s) return i = t, !1 }), null !== (i = null === i ? this.tabs.index(this.tabs.filter(".ui-tabs-active")) : i) && -1 !== i || (i = !!this.tabs.length && 0)), !1 !== i && -1 === (i = this.tabs.index(this.tabs.eq(i))) && (i = !t && 0), i = !t && !1 === i && this.anchors.length ? 0 : i }, _getCreateEventData: function () { return { tab: this.active, panel: this.active.length ? this._getPanelForTab(this.active) : V() } }, _tabKeydown: function (t) { var e = V(V.ui.safeActiveElement(this.document[0])).closest("li"), i = this.tabs.index(e), s = !0; if (!this._handlePageNav(t)) { switch (t.keyCode) { case V.ui.keyCode.RIGHT: case V.ui.keyCode.DOWN: i++; break; case V.ui.keyCode.UP: case V.ui.keyCode.LEFT: s = !1, i--; break; case V.ui.keyCode.END: i = this.anchors.length - 1; break; case V.ui.keyCode.HOME: i = 0; break; case V.ui.keyCode.SPACE: return t.preventDefault(), clearTimeout(this.activating), void this._activate(i); case V.ui.keyCode.ENTER: return t.preventDefault(), clearTimeout(this.activating), void this._activate(i !== this.options.active && i); default: return }t.preventDefault(), clearTimeout(this.activating), i = this._focusNextTab(i, s), t.ctrlKey || t.metaKey || (e.attr("aria-selected", "false"), this.tabs.eq(i).attr("aria-selected", "true"), this.activating = this._delay(function () { this.option("active", i) }, this.delay)) } }, _panelKeydown: function (t) { this._handlePageNav(t) || t.ctrlKey && t.keyCode === V.ui.keyCode.UP && (t.preventDefault(), this.active.trigger("focus")) }, _handlePageNav: function (t) { return t.altKey && t.keyCode === V.ui.keyCode.PAGE_UP ? (this._activate(this._focusNextTab(this.options.active - 1, !1)), !0) : t.altKey && t.keyCode === V.ui.keyCode.PAGE_DOWN ? (this._activate(this._focusNextTab(this.options.active + 1, !0)), !0) : void 0 }, _findNextTab: function (t, e) { var i = this.tabs.length - 1; for (; -1 !== V.inArray(t = (t = i < t ? 0 : t) < 0 ? i : t, this.options.disabled);)t = e ? t + 1 : t - 1; return t }, _focusNextTab: function (t, e) { return t = this._findNextTab(t, e), this.tabs.eq(t).trigger("focus"), t }, _setOption: function (t, e) { "active" !== t ? (this._super(t, e), "collapsible" === t && (this._toggleClass("ui-tabs-collapsible", null, e), e || !1 !== this.options.active || this._activate(0)), "event" === t && this._setupEvents(e), "heightStyle" === t && this._setupHeightStyle(e)) : this._activate(e) }, _sanitizeSelector: function (t) { return t ? t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g, "\\$&") : "" }, refresh: function () { var t = this.options, e = this.tablist.children(":has(a[href])"); t.disabled = V.map(e.filter(".ui-state-disabled"), function (t) { return e.index(t) }), this._processTabs(), !1 !== t.active && this.anchors.length ? this.active.length && !V.contains(this.tablist[0], this.active[0]) ? this.tabs.length === t.disabled.length ? (t.active = !1, this.active = V()) : this._activate(this._findNextTab(Math.max(0, t.active - 1), !1)) : t.active = this.tabs.index(this.active) : (t.active = !1, this.active = V()), this._refresh() }, _refresh: function () { this._setOptionDisabled(this.options.disabled), this._setupEvents(this.options.event), this._setupHeightStyle(this.options.heightStyle), this.tabs.not(this.active).attr({ "aria-selected": "false", "aria-expanded": "false", tabIndex: -1 }), this.panels.not(this._getPanelForTab(this.active)).hide().attr({ "aria-hidden": "true" }), this.active.length ? (this.active.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 }), this._addClass(this.active, "ui-tabs-active", "ui-state-active"), this._getPanelForTab(this.active).show().attr({ "aria-hidden": "false" })) : this.tabs.eq(0).attr("tabIndex", 0) }, _processTabs: function () { var l = this, t = this.tabs, e = this.anchors, i = this.panels; this.tablist = this._getList().attr("role", "tablist"), this._addClass(this.tablist, "ui-tabs-nav", "ui-helper-reset ui-helper-clearfix ui-widget-header"), this.tablist.on("mousedown" + this.eventNamespace, "> li", function (t) { V(this).is(".ui-state-disabled") && t.preventDefault() }).on("focus" + this.eventNamespace, ".ui-tabs-anchor", function () { V(this).closest("li").is(".ui-state-disabled") && this.blur() }), this.tabs = this.tablist.find("> li:has(a[href])").attr({ role: "tab", tabIndex: -1 }), this._addClass(this.tabs, "ui-tabs-tab", "ui-state-default"), this.anchors = this.tabs.map(function () { return V("a", this)[0] }).attr({ tabIndex: -1 }), this._addClass(this.anchors, "ui-tabs-anchor"), this.panels = V(), this.anchors.each(function (t, e) { var i, s, n, o = V(e).uniqueId().attr("id"), a = V(e).closest("li"), r = a.attr("aria-controls"); l._isLocal(e) ? (n = (i = e.hash).substring(1), s = l.element.find(l._sanitizeSelector(i))) : (n = a.attr("aria-controls") || V({}).uniqueId()[0].id, (s = l.element.find(i = "#" + n)).length || (s = l._createPanel(n)).insertAfter(l.panels[t - 1] || l.tablist), s.attr("aria-live", "polite")), s.length && (l.panels = l.panels.add(s)), r && a.data("ui-tabs-aria-controls", r), a.attr({ "aria-controls": n, "aria-labelledby": o }), s.attr("aria-labelledby", o) }), this.panels.attr("role", "tabpanel"), this._addClass(this.panels, "ui-tabs-panel", "ui-widget-content"), t && (this._off(t.not(this.tabs)), this._off(e.not(this.anchors)), this._off(i.not(this.panels))) }, _getList: function () { return this.tablist || this.element.find("ol, ul").eq(0) }, _createPanel: function (t) { return V("").attr("id", t).data("ui-tabs-destroy", !0) }, _setOptionDisabled: function (t) { var e, i; for (Array.isArray(t) && (t.length ? t.length === this.anchors.length && (t = !0) : t = !1), i = 0; e = this.tabs[i]; i++)e = V(e), !0 === t || -1 !== V.inArray(i, t) ? (e.attr("aria-disabled", "true"), this._addClass(e, null, "ui-state-disabled")) : (e.removeAttr("aria-disabled"), this._removeClass(e, null, "ui-state-disabled")); this.options.disabled = t, this._toggleClass(this.widget(), this.widgetFullName + "-disabled", null, !0 === t) }, _setupEvents: function (t) { var i = {}; t && V.each(t.split(" "), function (t, e) { i[e] = "_eventHandler" }), this._off(this.anchors.add(this.tabs).add(this.panels)), this._on(!0, this.anchors, { click: function (t) { t.preventDefault() } }), this._on(this.anchors, i), this._on(this.tabs, { keydown: "_tabKeydown" }), this._on(this.panels, { keydown: "_panelKeydown" }), this._focusable(this.tabs), this._hoverable(this.tabs) }, _setupHeightStyle: function (t) { var i, e = this.element.parent(); "fill" === t ? (i = e.height(), i -= this.element.outerHeight() - this.element.height(), this.element.siblings(":visible").each(function () { var t = V(this), e = t.css("position"); "absolute" !== e && "fixed" !== e && (i -= t.outerHeight(!0)) }), this.element.children().not(this.panels).each(function () { i -= V(this).outerHeight(!0) }), this.panels.each(function () { V(this).height(Math.max(0, i - V(this).innerHeight() + V(this).height())) }).css("overflow", "auto")) : "auto" === t && (i = 0, this.panels.each(function () { i = Math.max(i, V(this).height("").height()) }).height(i)) }, _eventHandler: function (t) { var e = this.options, i = this.active, s = V(t.currentTarget).closest("li"), n = s[0] === i[0], o = n && e.collapsible, a = o ? V() : this._getPanelForTab(s), r = i.length ? this._getPanelForTab(i) : V(), i = { oldTab: i, oldPanel: r, newTab: o ? V() : s, newPanel: a }; t.preventDefault(), s.hasClass("ui-state-disabled") || s.hasClass("ui-tabs-loading") || this.running || n && !e.collapsible || !1 === this._trigger("beforeActivate", t, i) || (e.active = !o && this.tabs.index(s), this.active = n ? V() : s, this.xhr && this.xhr.abort(), r.length || a.length || V.error("jQuery UI Tabs: Mismatching fragment identifier."), a.length && this.load(this.tabs.index(s), t), this._toggle(t, i)) }, _toggle: function (t, e) { var i = this, s = e.newPanel, n = e.oldPanel; function o() { i.running = !1, i._trigger("activate", t, e) } function a() { i._addClass(e.newTab.closest("li"), "ui-tabs-active", "ui-state-active"), s.length && i.options.show ? i._show(s, i.options.show, o) : (s.show(), o()) } this.running = !0, n.length && this.options.hide ? this._hide(n, this.options.hide, function () { i._removeClass(e.oldTab.closest("li"), "ui-tabs-active", "ui-state-active"), a() }) : (this._removeClass(e.oldTab.closest("li"), "ui-tabs-active", "ui-state-active"), n.hide(), a()), n.attr("aria-hidden", "true"), e.oldTab.attr({ "aria-selected": "false", "aria-expanded": "false" }), s.length && n.length ? e.oldTab.attr("tabIndex", -1) : s.length && this.tabs.filter(function () { return 0 === V(this).attr("tabIndex") }).attr("tabIndex", -1), s.attr("aria-hidden", "false"), e.newTab.attr({ "aria-selected": "true", "aria-expanded": "true", tabIndex: 0 }) }, _activate: function (t) { var t = this._findActive(t); t[0] !== this.active[0] && (t = (t = !t.length ? this.active : t).find(".ui-tabs-anchor")[0], this._eventHandler({ target: t, currentTarget: t, preventDefault: V.noop })) }, _findActive: function (t) { return !1 === t ? V() : this.tabs.eq(t) }, _getIndex: function (t) { return t = "string" == typeof t ? this.anchors.index(this.anchors.filter("[href$='" + V.escapeSelector(t) + "']")) : t }, _destroy: function () { this.xhr && this.xhr.abort(), this.tablist.removeAttr("role").off(this.eventNamespace), this.anchors.removeAttr("role tabIndex").removeUniqueId(), this.tabs.add(this.panels).each(function () { V.data(this, "ui-tabs-destroy") ? V(this).remove() : V(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded") }), this.tabs.each(function () { var t = V(this), e = t.data("ui-tabs-aria-controls"); e ? t.attr("aria-controls", e).removeData("ui-tabs-aria-controls") : t.removeAttr("aria-controls") }), this.panels.show(), "content" !== this.options.heightStyle && this.panels.css("height", "") }, enable: function (i) { var t = this.options.disabled; !1 !== t && (t = void 0 !== i && (i = this._getIndex(i), Array.isArray(t) ? V.map(t, function (t) { return t !== i ? t : null }) : V.map(this.tabs, function (t, e) { return e !== i ? e : null })), this._setOptionDisabled(t)) }, disable: function (t) { var e = this.options.disabled; if (!0 !== e) { if (void 0 === t) e = !0; else { if (t = this._getIndex(t), -1 !== V.inArray(t, e)) return; e = Array.isArray(e) ? V.merge([t], e).sort() : [t] } this._setOptionDisabled(e) } }, load: function (t, s) { t = this._getIndex(t); function n(t, e) { "abort" === e && o.panels.stop(!1, !0), o._removeClass(i, "ui-tabs-loading"), a.removeAttr("aria-busy"), t === o.xhr && delete o.xhr } var o = this, i = this.tabs.eq(t), t = i.find(".ui-tabs-anchor"), a = this._getPanelForTab(i), r = { tab: i, panel: a }; this._isLocal(t[0]) || (this.xhr = V.ajax(this._ajaxSettings(t, s, r)), this.xhr && "canceled" !== this.xhr.statusText && (this._addClass(i, "ui-tabs-loading"), a.attr("aria-busy", "true"), this.xhr.done(function (t, e, i) { setTimeout(function () { a.html(t), o._trigger("load", s, r), n(i, e) }, 1) }).fail(function (t, e) { setTimeout(function () { n(t, e) }, 1) }))) }, _ajaxSettings: function (t, i, s) { var n = this; return { url: t.attr("href").replace(/#.*$/, ""), beforeSend: function (t, e) { return n._trigger("beforeLoad", i, V.extend({ jqXHR: t, ajaxSettings: e }, s)) } } }, _getPanelForTab: function (t) { t = V(t).attr("aria-controls"); return this.element.find(this._sanitizeSelector("#" + t)) } }), !1 !== V.uiBackCompat && V.widget("ui.tabs", V.ui.tabs, { _processTabs: function () { this._superApply(arguments), this._addClass(this.tabs, "ui-tab") } }); V.ui.tabs; V.widget("ui.tooltip", { version: "1.13.2", options: { classes: { "ui-tooltip": "ui-corner-all ui-widget-shadow" }, content: function () { var t = V(this).attr("title"); return V("
").text(t).html() }, hide: !0, items: "[title]:not([disabled])", position: { my: "left top+15", at: "left bottom", collision: "flipfit flip" }, show: !0, track: !1, close: null, open: null }, _addDescribedBy: function (t, e) { var i = (t.attr("aria-describedby") || "").split(/\s+/); i.push(e), t.data("ui-tooltip-id", e).attr("aria-describedby", String.prototype.trim.call(i.join(" "))) }, _removeDescribedBy: function (t) { var e = t.data("ui-tooltip-id"), i = (t.attr("aria-describedby") || "").split(/\s+/), e = V.inArray(e, i); -1 !== e && i.splice(e, 1), t.removeData("ui-tooltip-id"), (i = String.prototype.trim.call(i.join(" "))) ? t.attr("aria-describedby", i) : t.removeAttr("aria-describedby") }, _create: function () { this._on({ mouseover: "open", focusin: "open" }), this.tooltips = {}, this.parents = {}, this.liveRegion = V("").attr({ role: "log", "aria-live": "assertive", "aria-relevant": "additions" }).appendTo(this.document[0].body), this._addClass(this.liveRegion, null, "ui-helper-hidden-accessible"), this.disabledTitles = V([]) }, _setOption: function (t, e) { var i = this; this._super(t, e), "content" === t && V.each(this.tooltips, function (t, e) { i._updateContent(e.element) }) }, _setOptionDisabled: function (t) { this[t ? "_disable" : "_enable"]() }, _disable: function () { var s = this; V.each(this.tooltips, function (t, e) { var i = V.Event("blur"); i.target = i.currentTarget = e.element[0], s.close(i, !0) }), this.disabledTitles = this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function () { var t = V(this); if (t.is("[title]")) return t.data("ui-tooltip-title", t.attr("title")).removeAttr("title") })) }, _enable: function () { this.disabledTitles.each(function () { var t = V(this); t.data("ui-tooltip-title") && t.attr("title", t.data("ui-tooltip-title")) }), this.disabledTitles = V([]) }, open: function (t) { var i = this, e = V(t ? t.target : this.element).closest(this.options.items); e.length && !e.data("ui-tooltip-id") && (e.attr("title") && e.data("ui-tooltip-title", e.attr("title")), e.data("ui-tooltip-open", !0), t && "mouseover" === t.type && e.parents().each(function () { var t, e = V(this); e.data("ui-tooltip-open") && ((t = V.Event("blur")).target = t.currentTarget = this, i.close(t, !0)), e.attr("title") && (e.uniqueId(), i.parents[this.id] = { element: this, title: e.attr("title") }, e.attr("title", "")) }), this._registerCloseHandlers(t, e), this._updateContent(e, t)) }, _updateContent: function (e, i) { var t = this.options.content, s = this, n = i ? i.type : null; if ("string" == typeof t || t.nodeType || t.jquery) return this._open(i, e, t); (t = t.call(e[0], function (t) { s._delay(function () { e.data("ui-tooltip-open") && (i && (i.type = n), this._open(i, e, t)) }) })) && this._open(i, e, t) }, _open: function (t, e, i) { var s, n, o, a = V.extend({}, this.options.position); function r(t) { a.of = t, n.is(":hidden") || n.position(a) } i && ((s = this._find(e)) ? s.tooltip.find(".ui-tooltip-content").html(i) : (e.is("[title]") && (t && "mouseover" === t.type ? e.attr("title", "") : e.removeAttr("title")), s = this._tooltip(e), n = s.tooltip, this._addDescribedBy(e, n.attr("id")), n.find(".ui-tooltip-content").html(i), this.liveRegion.children().hide(), (i = V("
").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"), i.removeAttr("id").find("[id]").removeAttr("id"), i.appendTo(this.liveRegion), this.options.track && t && /^mouse/.test(t.type) ? (this._on(this.document, { mousemove: r }), r(t)) : n.position(V.extend({ of: e }, this.options.position)), n.hide(), this._show(n, this.options.show), this.options.track && this.options.show && this.options.show.delay && (o = this.delayedShow = setInterval(function () { n.is(":visible") && (r(a.of), clearInterval(o)) }, 13)), this._trigger("open", t, { tooltip: n }))) }, _registerCloseHandlers: function (t, e) { var i = { keyup: function (t) { t.keyCode === V.ui.keyCode.ESCAPE && ((t = V.Event(t)).currentTarget = e[0], this.close(t, !0)) } }; e[0] !== this.element[0] && (i.remove = function () { var t = this._find(e); t && this._removeTooltip(t.tooltip) }), t && "mouseover" !== t.type || (i.mouseleave = "close"), t && "focusin" !== t.type || (i.focusout = "close"), this._on(!0, e, i) }, close: function (t) { var e, i = this, s = V(t ? t.currentTarget : this.element), n = this._find(s); n ? (e = n.tooltip, n.closing || (clearInterval(this.delayedShow), s.data("ui-tooltip-title") && !s.attr("title") && s.attr("title", s.data("ui-tooltip-title")), this._removeDescribedBy(s), n.hiding = !0, e.stop(!0), this._hide(e, this.options.hide, function () { i._removeTooltip(V(this)) }), s.removeData("ui-tooltip-open"), this._off(s, "mouseleave focusout keyup"), s[0] !== this.element[0] && this._off(s, "remove"), this._off(this.document, "mousemove"), t && "mouseleave" === t.type && V.each(this.parents, function (t, e) { V(e.element).attr("title", e.title), delete i.parents[t] }), n.closing = !0, this._trigger("close", t, { tooltip: e }), n.hiding || (n.closing = !1))) : s.removeData("ui-tooltip-open") }, _tooltip: function (t) { var e = V("
").attr("role", "tooltip"), i = V("
").appendTo(e), s = e.uniqueId().attr("id"); return this._addClass(i, "ui-tooltip-content"), this._addClass(e, "ui-tooltip", "ui-widget ui-widget-content"), e.appendTo(this._appendTo(t)), this.tooltips[s] = { element: t, tooltip: e } }, _find: function (t) { t = t.data("ui-tooltip-id"); return t ? this.tooltips[t] : null }, _removeTooltip: function (t) { clearInterval(this.delayedShow), t.remove(), delete this.tooltips[t.attr("id")] }, _appendTo: function (t) { t = t.closest(".ui-front, dialog"); return t = !t.length ? this.document[0].body : t }, _destroy: function () { var s = this; V.each(this.tooltips, function (t, e) { var i = V.Event("blur"), e = e.element; i.target = i.currentTarget = e[0], s.close(i, !0), V("#" + t).remove(), e.data("ui-tooltip-title") && (e.attr("title") || e.attr("title", e.data("ui-tooltip-title")), e.removeData("ui-tooltip-title")) }), this.liveRegion.remove() } }), !1 !== V.uiBackCompat && V.widget("ui.tooltip", V.ui.tooltip, { options: { tooltipClass: null }, _tooltip: function () { var t = this._superApply(arguments); return this.options.tooltipClass && t.tooltip.addClass(this.options.tooltipClass), t } }); V.ui.tooltip });
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
if(!$('html').hasClass('msie8')){
/*Animate on scroll AOS plugin*/!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AOS=t():e.AOS=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p="dist/",t(0)}([function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=Object.assign||function(e){for(var t=1;t
-1?O(!0):"load"===j.startEvent?window.addEventListener(j.startEvent,function(){O(!0)}):document.addEventListener(j.startEvent,function(){O(!0)}),window.addEventListener("resize",(0,s["default"])(O,50,!0)),window.addEventListener("orientationchange",(0,s["default"])(O,50,!0)),window.addEventListener("scroll",(0,c["default"])(function(){(0,b["default"])(h,j.once)},99)),document.addEventListener("DOMNodeRemoved",function(e){var t=e.target;t&&1===t.nodeType&&t.hasAttribute&&t.hasAttribute("data-aos")&&(0,s["default"])(_,50,!0)}),(0,f["default"])("[data-aos]",_),h)};e.exports={init:E,refresh:O,refreshHard:_}},function(e,t){},,,,function(e,t,o){"use strict";function n(e,t,o){var n=!0,a=!0;if("function"!=typeof e)throw new TypeError(c);return i(o)&&(n="leading"in o?!!o.leading:n,a="trailing"in o?!!o.trailing:a),r(e,t,{leading:n,maxWait:t,trailing:a})}function i(e){var t="undefined"==typeof e?"undefined":a(e);return!!e&&("object"==t||"function"==t)}var a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},r=o(6),c="Expected a function";e.exports=n},function(e,t){"use strict";function o(e,t,o){function n(t){var o=b,n=v;return b=v=void 0,O=t,y=e.apply(n,o)}function a(e){return O=e,w=setTimeout(d,t),_?n(e):y}function r(e){var o=e-h,n=e-O,i=t-o;return z?x(i,g-n):i}function u(e){var o=e-h,n=e-O;return!h||o>=t||0>o||z&&n>=g}function d(){var e=j();return u(e)?f(e):void(w=setTimeout(d,r(e)))}function f(e){return clearTimeout(w),w=void 0,A&&b?n(e):(b=v=void 0,y)}function l(){void 0!==w&&clearTimeout(w),h=O=0,b=v=w=void 0}function m(){return void 0===w?y:f(j())}function p(){var e=j(),o=u(e);if(b=arguments,v=this,h=e,o){if(void 0===w)return a(h);if(z)return clearTimeout(w),w=setTimeout(d,t),n(h)}return void 0===w&&(w=setTimeout(d,t)),y}var b,v,g,y,w,h=0,O=0,_=!1,z=!1,A=!0;if("function"!=typeof e)throw new TypeError(s);return t=c(t)||0,i(o)&&(_=!!o.leading,z="maxWait"in o,g=z?k(c(o.maxWait)||0,t):g,A="trailing"in o?!!o.trailing:A),p.cancel=l,p.flush=m,p}function n(e){var t=i(e)?h.call(e):"";return t==f||t==l}function i(e){var t="undefined"==typeof e?"undefined":u(e);return!!e&&("object"==t||"function"==t)}function a(e){return!!e&&"object"==("undefined"==typeof e?"undefined":u(e))}function r(e){return"symbol"==("undefined"==typeof e?"undefined":u(e))||a(e)&&h.call(e)==m}function c(e){if("number"==typeof e)return e;if(r(e))return d;if(i(e)){var t=n(e.valueOf)?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(p,"");var o=v.test(e);return o||g.test(e)?y(e.slice(2),o?2:8):b.test(e)?d:+e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},s="Expected a function",d=NaN,f="[object Function]",l="[object GeneratorFunction]",m="[object Symbol]",p=/^\s+|\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,g=/^0o[0-7]+$/i,y=parseInt,w=Object.prototype,h=w.toString,k=Math.max,x=Math.min,j=Date.now;e.exports=o},function(e,t){"use strict";function o(e,t){r.push({selector:e,fn:t}),!c&&a&&(c=new a(n),c.observe(i.documentElement,{childList:!0,subtree:!0,removedNodes:!0})),n()}function n(){for(var e,t,o=0,n=r.length;n>o;o++){e=r[o],t=i.querySelectorAll(e.selector);for(var a,c=0,u=t.length;u>c;c++)a=t[c],a.ready||(a.ready=!0,e.fn.call(a,a))}}Object.defineProperty(t,"__esModule",{value:!0});var i=window.document,a=window.MutationObserver||window.WebKitMutationObserver,r=[],c=void 0;t["default"]=o},function(e,t){"use strict";function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var o=0;oe.position?e.node.classList.add("aos-animate"):"undefined"!=typeof n&&("false"===n||!o&&"true"!==n)&&e.node.classList.remove("aos-animate")},n=function(e,t){var n=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,a){o(e,i+n,t)})};t["default"]=n},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=o(11),a=n(i),r=function(e,t){return e.forEach(function(e,o){e.node.classList.add("aos-init"),e.position=(0,a["default"])(e.node,t.offset)}),e};t["default"]=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=o(12),a=n(i),r=function(e,t){var o=0,n=0,i=window.innerHeight,r={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(r.offset&&!isNaN(r.offset)&&(n=parseInt(r.offset)),r.anchor&&document.querySelectorAll(r.anchor)&&(e=document.querySelectorAll(r.anchor)[0]),o=(0,a["default"])(e).top,r.anchorPlacement){case"top-bottom":break;case"center-bottom":o+=e.offsetHeight/2;break;case"bottom-bottom":o+=e.offsetHeight;break;case"top-center":o+=i/2;break;case"bottom-center":o+=i/2+e.offsetHeight;break;case"center-center":o+=i/2+e.offsetHeight/2;break;case"top-top":o+=i;break;case"bottom-top":o+=e.offsetHeight+i;break;case"center-top":o+=e.offsetHeight/2+i}return r.anchorPlacement||r.offset||isNaN(t)||(n=t),o+n};t["default"]=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){for(var t=0,o=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),o+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:o,left:t}};t["default"]=o},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(e){e=e||document.querySelectorAll("[data-aos]");var t=[];return[].forEach.call(e,function(e,o){t.push({node:e})}),t};t["default"]=o}])});
// sourceMappingURL=aos.js.map
}
/*! jQuery Validation Plugin - v1.20.0 - 10/10/2023
* https://jqueryvalidation.org/
* Copyright (c) 2023 Jörn Zaefferer; Licensed MIT */
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a(" ").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'], [type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox'], [contenteditable], [type='button']",b).on("click.validate","select, option, [type='radio'], [type='checkbox']",b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea, [contenteditable]").not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);this.abortRequest(b),"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=". Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;aWarning: No message defined for "+b.name+""),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||"")):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return void 0===a?"":a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},elementAjaxPort:function(a){return"validate"+a.name},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()&&0===this.pendingRequest?(a(this.currentForm).trigger("submit"),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},abortRequest:function(b){var c;this.pending[b.name]&&(c=this.elementAjaxPort(b),a.ajaxAbort(c),this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass))},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a["date"===b?"dateISO":c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(a,d){b[a]="function"==typeof d&&"normalizer"!==a?d(c):d}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var a;b[this]&&(Array.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(a=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(a[0]),Number(a[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c},maxlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d<=c},rangelength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),i.old===h?i.valid:(i.old=h,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:this.elementAjaxPort(c),dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(b,c,e){var f=b.port;"abort"===b.mode&&(a.ajaxAbort(f),d[f]=e)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(a.ajaxAbort(f),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a.ajaxAbort=function(a){d[a]&&(d[a].abort(),delete d[a])},a});
$(document).ready(function () {
// function to set and reset aria-describedby ID in case of validation error
var fnSetDescribedByID = function ($ele, action) {
var $parElem = $ele.closest('.row'),
isSelect = $ele.hasClass('dropdown-select'),
prevDesc,
isSet = $ele.attr('data-isset');
if ((action === 'set' && isSet) || (action !== 'set' && !isSet)) {
return;
}
if (action === 'set') {
var desId = $parElem.find('.error-text').attr('id');
prevDesc = $ele.attr('aria-describedby');
prevDesc = prevDesc ? prevDesc : 'no-desc';
$ele.attr({
'data-describedby': prevDesc,
'aria-describedby': desId,
'data-isset': 'true'
});
} else {
prevDesc = $ele.attr('data-describedby');
if (!prevDesc || prevDesc === 'no-desc') {
$ele.removeAttr('aria-describedby');
} else {
$ele.attr('aria-describedby', prevDesc);
}
$ele.removeAttr('data-describedby').removeAttr('data-isset');
}
if (isSelect && $ele.selectmenu('instance')) {
fnSetDescribedByID($ele.next('span'), action);
}
};
//BELOW ARE ALL ADDIOTIONAL METHODS
(function ($) {
function futureDateCheck(value) {
var values = value.split("/"),
returnVal = 1,
date = new Date(),
curr_date = date.getDate(),
curr_month = date.getMonth(),
curr_year = date.getFullYear();
if (values.length == 3) {
if (values[2] < curr_year) {
return true;
} else if (values[2] == curr_year && values[1] < curr_month + 1) {
return true;
} else if (values[2] == curr_year && values[1] == curr_month + 1) {
if (values[0] <= curr_date) {
return true;
} else {
return false;
}
} else if (values[2] > curr_year) {
return false;
}
} else if (values.length == 2) {
if (values[1] < curr_year) {
return true;
} else if (values[1] == curr_year) {
if (values[0] <= curr_month + 1) {
return true;
} else {
return false;
}
}
} else if (values.length == 1) {
if (values[0] <= curr_year) {
return true;
}
}
}
function futureDateCheckCwf(value) {
var values = value.split("/"),
returnVal = 1,
date = new Date(),
curr_date = date.getDate(),
curr_month = date.getMonth(),
curr_year = date.getFullYear();
if (values.length == 3) {
if (values[2] > curr_year) {
return true;
} else if (values[2] == curr_year && values[1] > curr_month + 1) {
return true;
} else if (values[2] == curr_year && values[1] == curr_month + 1) {
if (values[0] >= curr_date) {
return true;
} else {
return false;
}
} else if (values[2] < curr_year) {
return false;
}
} else if (values.length == 2) {
if (values[1] > curr_year) {
return true;
} else if (values[1] == curr_year) {
if (values[0] >= curr_month + 1) {
return true;
} else {
return false;
}
}
} else if (values.length == 1) {
if (values[0] >= curr_year) {
return true;
}
}
}
function getAge(dateString) {
var today = new Date(),
birthDate = new Date(dateString),
age = today.getFullYear() - birthDate.getFullYear(),
m = today.getMonth() - birthDate.getMonth();
if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) {
age--;
}
return age;
}
Array.prototype.zip = function (other) {
var result = [];
/*Modified for defect #2575832*/
if (typeof other !== "function") {
while ((this.length > 0) || (other.length > 0)) {
if (this.length > 0) {
result.push(this.shift());
}
if (other.length > 0) {
result.push(other.shift());
}
}
}
return result;
};
function _fnValue(tag) {
var key = tag.substr(1, tag.length - 2),
_element = $('#main-content-wrapper form:visible input[name=' + key + ']'),
keyVal = _element.val() ? _element.val().replace(/,/g, "") : '0';
if (_element.hasClass('input-currency')) {
var cur = _element.closest('[data-currency]').attr('data-currency');
if (keyVal && keyVal.indexOf(cur) >= 0) {
keyVal = keyVal.replace(cur, "").trim();
}
}
return keyVal;
}
function populate(template) {
var tagRegExp = /{.+?}/g;
var tags = template.match(tagRegExp);
var values = tags.map(_fnValue);
for (var m in values) {
if (values[m] == "") {
values[m] = 0;
} else if (typeof values[m] === "string") {
values[m] = values[m].replace(/,/g, "");
}
}
return template.split(tagRegExp).zip(values).join("");
}
//Validates if the date entered is not before customers date of birth or future date.
$.validator.addMethod("mortgagedtentered", function (value, element, param) {
var valid = false,
dob = populate(param),
dateRev = new Date(value.split("/").reverse().join("-")),
dobRev = new Date(dob.split("/").reverse().join("-"));
if (value.split("/").length == 2) {
var dobArr = dob.split("/");
dobArr.splice(0, 1);
dobRev = new Date(dobArr.reverse().join("-"));
}
if (dateRev >= dobRev) {
valid = true;
}
return valid && futureDateCheck(value);
});
//Validates if the date entered is within specified property build years.
$.validator.addMethod("mortgagepropertybuild", function (value, element, param) {
var valid = false,
buildDate = new Date(value.split("/").reverse().join("-"));
if ((getAge(buildDate) + 1) <= param) {
valid = true;
}
return valid;
});
// Validation Method for none
$.validator.addMethod("None", function (value, element, param) {
return true;
});
// Validation Method for minimum value
$.validator.addMethod("min", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
if ($(element).hasClass('input-date-dd')) {
var dateDDregex = /[0-9]{2}/;
value = dateDDregex.exec(value);
}
return value >= param;
});
// Validation Method for maximum value
$.validator.addMethod("max", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
if ($(element).hasClass('input-date-dd')) {
var dateDDregex = /[0-9]{2}/;
value = dateDDregex.exec(value);
}
return value <= param;
});
// Validation Method for maximumabs value
$.validator.addMethod("maxabs", function (value, element, param) {
value = value.replace(/,/g, "");
return Math.abs(value) <= param;
});
// Validation Method for minabs value
$.validator.addMethod("minabs", function(value, element, param) {
value = value.replace(/,/g, "");
return Math.abs(value) >= param;
});
// Validation Method for Decimal numbers
$.validator.addMethod("dmpnumeric", function (value, element, param) {
value = value.replace(/,/g, "");
var cur = $(element).closest("[data-currency]").attr("data-currency");
if ($(element).hasClass("input-currency") || (value.indexOf(cur) >= 0)) {
if (value.indexOf(cur) >= 0) {
value = value.split(cur)[1];
}
}
if ($(element).hasClass("input-percentage")) {
if (value.indexOf("%") >= 0) {
value = value.split("%")[0];
}
}
var reg = new RegExp("^\\s*(\\+|-)?((\\d+(\\.\\d*)?)|(\\.\\d+))\\s*$");
return this.optional(element) || reg.test(value);
});
// Validation Method for Natyes numeric
$.validator.addMethod("natyesnumeric", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
if (value.indexOf(".") >= 0) {
return false;
} else {
return this.optional(element) || (value >= 0);
}
});
//Validation method for alpha numeric
$.validator.addMethod("alpha", function (value, element, param) {
var reg = new RegExp("^[a-zA-Z0-9 ]+$");
return this.optional(element) || (reg.test($.trim(value)));
});
//Validation method for dmp filter
$.validator.addMethod("filter", function (value, element, param) {
if ($(element).hasClass('input-currency')) {
value = value.replace(/,/g, "");
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
return true;
});
//Validation method for checking Range
$.validator.addMethod("dmprange", function (value, element, param) {
if (typeof param === 'string' && param.indexOf('[') >= 0) {
param = JSON.parse(param);
}
var cur;
if ($(element).closest("[data-currency]").length > 0) {
cur = $(element)
.closest("[data-currency]")
.attr("data-currency");
} else {
cur = $(element).attr("placeholder");
}
if ($(element).hasClass('input-currency') || (value.indexOf(cur) >= 0)) {
if (value.indexOf(cur) >= 0) {
//value = value.split(cur)[1];
value = value.replace(cur, "").trim();
}
value = value.replace(/,/g, "");
}
if ($(element).hasClass('input-percentage')) {
if (value.indexOf('%') >= 0) {
value = value.replace('%', "");
}
}
if ($(element).hasClass('input-date-dd')) {
var dateDDregex = /[0-9]{2}/;
value = dateDDregex.exec(value);
}
if (value.indexOf('month') >= 0 || value.indexOf('year') >= 0) {
value = parseInt(value);
}
return this.optional(element) || (value >= param[0] && value <= param[1]);
});
//Validation method for date format
$.validator.addMethod("date", function (value, element, param) {
if (param.length == 0 || param == "" || param == " ") {
param == "dd/MM/yyyy";
}
var dateRegex = "";
value = value.replace(/,/g, "");
if (param == "dd/MM/yyyy") {
if (element.value != "") {
values = element.value.split("/");
if (values.length == 3) {
if (values[0].length == 1) {
values[0] = "0" + values[0];
}
if (values[1].length == 1) {
values[1] = "0" + values[1];
}
element.value = values[0] + "/" + values[1] + "/" + values[2];
}
}
dateRegex = /^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/]\d\d\d\d$/;
return this.optional(element) || ((dateRegex.test(element.value)) && futureDateCheck(value));
} else if (param == "MM/yyyy") {
if (element.value != "") {
values = element.value.split("/");
if (values.length == 2) {
if (values[0].length == 1) {
values[0] = "0" + values[0];
}
element.value = values[0] + "/" + values[1];
}
}
dateRegex = /^(0[1-9]|1[012])[/]\d\d\d\d$/;
return this.optional(element) || ((dateRegex.test(element.value))) && futureDateCheck(value);
} else if (param == "yyyy") {
dateRegex = /^\d\d\d\d$/;
return this.optional(element) || (dateRegex.test(element.value)) && futureDateCheck(value);
} else if (param == "dd") {
if ($(element).hasClass('input-date-dd')) {
var dateDDregex = /[0-9]{2}/;
value = dateDDregex.exec(value);
}
digitReg = /^\d$/;
if (digitReg.test(value)) {
element.value = "0" + value;
}
dateRegex = /^(0[1-9]|[12][0-9]|3[01])$/;
return this.optional(element) || (dateRegex.test(element.value));
}
});
$.validator.addMethod("datecwf", function (value, element, param) {
if (param.length == 0 || param == "" || param == " " || param == "DD/MM/YYYY" || param == "dd/mm/yyyy") {
param = "dd/MM/yyyy";
}
var dateRegex = "";
value = value.replace(/,/g, "");
if (param == "dd/MM/yyyy") {
if (element.value != "") {
values = element.value.split("/");
if (values.length == 3) {
if (values[0].length == 1) {
values[0] = "0" + values[0];
}
if (values[1].length == 1) {
values[1] = "0" + values[1];
}
element.value = values[0] + "/" + values[1] + "/" + values[2];
}
}
dateRegex = /^(0[1-9]|[12][0-9]|3[01])[/](0[1-9]|1[012])[/]\d\d\d\d$/;
return this.optional(element) || ((dateRegex.test(element.value)) && futureDateCheckCwf(value));
} else if (param == "MM/yyyy") {
if (element.value != "") {
values = element.value.split("/");
if (values.length == 2) {
if (values[0].length == 1) {
values[0] = "0" + values[0];
}
element.value = values[0] + "/" + values[1];
}
}
dateRegex = /^(0[1-9]|1[012])[/]\d\d\d\d$/;
return this.optional(element) || ((dateRegex.test(element.value))) && futureDateCheckCwf(value);
} else if (param == "yyyy") {
dateRegex = /^\d\d\d\d$/;
return this.optional(element) || (dateRegex.test(element.value)) && futureDateCheckCwf(value);
} else if (param == "dd") {
digitReg = /^\d$/;
if (digitReg.test(value)) {
element.value = "0" + value;
}
dateRegex = /^(0[1-9]|[12][0-9]|3[01])$/;
return this.optional(element) || (dateRegex.test(element.value));
}
});
//Validation method for checking dob range
$.validator.addMethod("natyesdob", function (value, element, param) {
var dobMinValue = 18,
dobMaxValue = 90;
var minAgeValue,
maxAgeValue,
$parElem = $(element).closest('.form-field-wrap');
minAgeValue = $parElem.find("input[name='dobminagevalue']");
maxAgeValue = $parElem.find("input[name='dobmaxagevalue']");
if (minAgeValue.length > 0) {
if (minAgeValue.val() != "") {
dobMinValue = minAgeValue.val();
}
}
if (maxAgeValue.length > 0) {
if (maxAgeValue.val() != "") {
dobMaxValue = maxAgeValue.val();
}
}
var convertDate = value.split("/");
if(+convertDate[2]<=99)
{
convertDate[2]='0100';
}
var newdate = convertDate[2] + "/" + convertDate[1] + "/" + convertDate[0],
personsAge = getAge(newdate);
return this.optional(element) || (personsAge >= dobMinValue && personsAge < dobMaxValue);
});
//DMP Alphabets - validator method
$.validator.addMethod("alphabets", function (value, element, param) {
var reg = new RegExp("^[a-zA-Z ]+$");
if (value.trim().length > 0) {
return this.optional(element) || (reg.test(value));
} else {
return false;
}
});
//multi equal constraint
$.validator.addMethod("multiequal", function (value, element, param) {
if (param.indexOf(",") > 0) {
var multiequal = param.split(",");
for (var i = 0; i < multiequal.length; i++) {
if (multiequal[i] == value) {
return true;
}
}
return false;
}
return false;
});
// The below validator method is for Max loan config expression selected in constraints. Used for Mortgage tool flows
$.validator.addMethod("maxloanconfig", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
var propertyValue = $('[data-field-name*="propertyValue"]:visible .input-field').val(),
$propInput, ltvPercentage;
//get property value for aip jouney
if ($('.aip-page.aip-borrowing-details').length) {
if ($(".aip-borrowings-textfield-price:visible").length) {
$propInput = $(".aip-borrowings-textfield-price:visible input.input-field");
propertyValue = Number($propInput.val().replace(/,/g, "").replace(cur, ""));
} else {
$propInput = $(".aip-borrowings-textfield-property-value:visible input.input-field");
propertyValue = Number($propInput.val().replace(/,/g, "").replace(cur, ""));
}
} else { //get property value for mrf journey
if ($(".ec-field-wrap[data-field-name='PropertyValue']:visible").length) {
$propInput = $(".ec-field-wrap[data-field-name='PropertyValue']:visible input.input-field");
propertyValue = Number($propInput.val().replace(/,/g, "").replace(cur, ""));
} else if ($(".ec-field-wrap[data-field-name='PropertyValueSecond']:visible").length) {
$propInput = $(".ec-field-wrap[data-field-name='PropertyValueSecond']:visible input.input-field");
propertyValue = Number($propInput.val().replace(/,/g, "").replace(cur, ""));
}
}
param = param.split(",");
for (i = 0; i < param.length; i++) {
var paramVal = param[i],
ltvRange, ltvValue;
paramVal = param[i].split("|");
ltvRange = paramVal[0].substr(param[i].indexOf("(") + 1, (param[i].indexOf(")") - param[i].indexOf("(") - 1));
ltvRange = ltvRange.split("-");
var propValue = paramVal[1],
maxLoanValue;
propValue = propValue.split("<=");
maxLoanValue = Number(propValue[1]);
propValue = propValue[0].match(/{.*?}/g);
//check when amount outstanding is present
if (($(".ec-field-wrap[data-field-name='depositWorthSecond']:visible").length) || ($('.aip-borrowings-textfield-amount-outstanding:visible').length)) {
if ((Parser.evaluate(populate(propValue[1])) >= 0 && ($('.aip-borrowings-textfield-additional-borrowing:visible').length)) || (Parser.evaluate(populate(propValue[1])) >= 0 && ($(".ec-field-wrap[data-field-name='depositWorthSecond']:visible").length))) {
propValue = Parser.evaluate(populate(propValue[0])) + Parser.evaluate(populate(propValue[1]));
ltvPercentage = (propValue / propertyValue);
ltvValue = (ltvPercentage * 100);
} else {
propValue = Parser.evaluate(populate(propValue[0]));
ltvPercentage = (propValue / propertyValue);
ltvValue = (ltvPercentage * 100);
}
} else {
ltvPercentage = ((Parser.evaluate(populate(propValue[1])) / Parser.evaluate(populate(propValue[0]))) * 100);
ltvValue = 100 - ltvPercentage;
propValue = Parser.evaluate(populate(propValue[0])) - Parser.evaluate(populate(propValue[1]));
}
if (ltvValue <= ltvRange[0] && ltvValue > ltvRange[1]) {
if (propValue <= maxLoanValue)
return true;
return false;
}
}
});
// The below validator method is for Natyes expression selected in constraints. Used for Mortgage tool flows
$.validator.addMethod("expression", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
var greaterequals = "false",
lessequals = "false",
equals = "false",
less = "false",
greater = "false";
if (param.indexOf(">=") == 0) {
param = param.replace(">=", "");
greaterequals = "true";
} else if (param.indexOf("<=") == 0) {
param = param.replace("<=", "");
lessequals = "true";
} else if (param.indexOf(">") == 0) {
param = param.replace(">", "");
greater = "true";
} else if (param.indexOf("<") == 0) {
param = param.replace("<", "");
less = "true";
} else if (param.indexOf("=") == 0) {
param = param.replace("=", "");
equals = "true";
} else {
return false;
}
var finalVal = Parser.evaluate(populate(param));
if (greaterequals == "true") {
return this.optional(element) || value >= finalVal;
} else if (lessequals == "true") {
return this.optional(element) || value <= finalVal;
} else if (equals == "true") {
return this.optional(element) || value == finalVal;
} else if (less == "true") {
return this.optional(element) || value < finalVal;
} else if (greater == "true") {
return this.optional(element) || value > finalVal;
} else {
return false;
}
});
// The below validator method is for Property expression selected in constraints. Used for Mortgage tool flows
$.validator.addMethod("propertyexpression", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
var greaterequals = "false",
lessequals = "false",
equals = "false",
less = "false",
greater = "false";
if (param.indexOf(">=") == 0) {
param = param.replace(">=", "");
greaterequals = "true";
} else if (param.indexOf("<=") == 0) {
param = param.replace("<=", "");
lessequals = "true";
} else if (param.indexOf(">") == 0) {
param = param.replace(">", "");
greater = "true";
} else if (param.indexOf("<") == 0) {
param = param.replace("<", "");
less = "true";
} else if (param.indexOf("=") == 0) {
param = param.replace("=", "");
equals = "true";
} else {
return false;
}
var finalVal = Parser.evaluate(populate(param));
if (greaterequals == "true") {
return this.optional(element) || value >= finalVal;
} else if (lessequals == "true") {
return this.optional(element) || value <= finalVal;
} else if (equals == "true") {
return this.optional(element) || value == finalVal;
} else if (less == "true") {
return this.optional(element) || value < finalVal;
} else if (greater == "true") {
return this.optional(element) || value > finalVal;
} else {
return false;
}
});
// The below validator method is for confirm expression selected in constraints. Used for CWF tool flows
$.validator.addMethod("confirmexpression", function (value, element, param) {
value = value.replace(/,/g, "");
if ($(element).hasClass('input-currency')) {
var cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
var greaterequals = "false",
lessequals = "false",
equals = "false",
less = "false",
greater = "false";
if (param.indexOf(">=") == 0) {
param = param.replace(">=", "");
greaterequals = "true";
} else if (param.indexOf("<=") == 0) {
param = param.replace("<=", "");
lessequals = "true";
} else if (param.indexOf(">") == 0) {
param = param.replace(">", "");
greater = "true";
} else if (param.indexOf("<") == 0) {
param = param.replace("<", "");
less = "true";
} else if (param.indexOf("=") == 0) {
param = param.replace("=", "");
equals = "true";
} else {
return false;
}
var finalVal = populate(param);
if (greaterequals == "true") {
return this.optional(element) || value >= finalVal;
} else if (lessequals == "true") {
return this.optional(element) || value <= finalVal;
} else if (equals == "true") {
return this.optional(element) || value == finalVal;
} else if (less == "true") {
return this.optional(element) || value < finalVal;
} else if (greater == "true") {
return this.optional(element) || value > finalVal;
} else {
return false;
}
});
/* Validation method for MRF BTL LTV*/
$.validator.addMethod("mrfltv", function (value, element, param) {
value = value.replace(/,/g, "");
var cur;
if ($(element).hasClass('input-currency')) {
cur = $(element).closest('[data-currency]').attr('data-currency');
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
}
var greaterequals = "false",
lessequals = "false",
equals = "false",
less = "false",
greater = "false";
if (param.indexOf(">=") == 0) {
param = param.replace(">=", "");
greaterequals = "true";
} else if (param.indexOf("<=") == 0) {
param = param.replace("<=", "");
lessequals = "true";
} else if (param.indexOf(">") == 0) {
param = param.replace(">", "");
greater = "true";
} else if (param.indexOf("<") == 0) {
param = param.replace("<", "");
less = "true";
} else if (param.indexOf("=") == 0) {
param = param.replace("=", "");
equals = "true";
} else {
return false;
}
var $formMortageFinder = $('#main-content-wrapper form:visible'),
LTV = 0,
$fieldWrapper = $('.aip-page.aip-borrowing-details').length ? $('.aip-page.aip-borrowing-details') : $formMortageFinder;
var propvalueSecond = $fieldWrapper.find('[data-field-name*="PropertyValue"]:visible .input-field,[data-field-name*="propertyValue"]:visible .input-field').val(),
depositValSecond = $fieldWrapper.find('[data-field-name*="depositWorth"]:visible .input-field').val();
propvalueSecond = globalUtil.replaceComma(propvalueSecond).replace(cur, "");
depositValSecond = globalUtil.replaceComma(depositValSecond).replace(cur, "");
LTV = Math.round(((parseInt(depositValSecond) + parseInt(value)) / parseInt(propvalueSecond)) * 100);
if (!$.isNumeric(LTV)) {
return true;
}
var elementName = element.name;
var errorMsg = IDM.validationMsgs[elementName].mrfltv;
errorMsg = errorMsg.replace('{ltv}', LTV);
$formMortageFinder.validate().settings.messages[elementName].mrfltv = errorMsg; // dynamic message display
var finalVal = parseInt(param);
if (greaterequals == "true") {
return this.optional(element) || LTV >= finalVal;
} else if (lessequals == "true") {
return this.optional(element) || LTV <= finalVal;
} else if (equals == "true") {
return this.optional(element) || LTV == finalVal;
} else if (less == "true") {
return this.optional(element) || LTV < finalVal;
} else if (greater == "true") {
return this.optional(element) || LTV > finalVal;
} else {
return false;
}
});
/*
Below expression is a contraint added to BTL income field
to check if gross income(*type) + other income
is greater than param value
In case of joint applicant either of the applicant
should have gross income(*type) + other income
greater than param value
*/
$.validator.addMethod("btlincomeexpression", function (value, element, param) {
var $category = $(element).closest('[data-sub-category]'),
cur = $(element).closest('[data-currency]').attr('data-currency'),
categoryName = $category.attr('data-sub-category'),
$inputFields = $category.find('.input-field.input-currency:visible'),
totalIncome = 0,
finalVal = true;
if ($inputFields.length) {
$.each($inputFields, function () {
totalIncome += Number(globalUtil.replaceComma($(this).val().replace(cur, '')));
});
}
if (categoryName === 'joint') {
var soleIncome = $('[data-fbpof="income_details"] [data-target="income"] .aip-fbp-amount').text();
soleIncome = globalUtil.replaceComma(soleIncome.replace(cur, ''));
if (Number(soleIncome) < Number(param) && totalIncome < Number(param)) {
finalVal = false;
}
} else {
if (totalIncome < Number(param)) {
finalVal = false;
}
}
return this.optional(element) || finalVal;
});
/*
Below expression is a contraint added to BTL property field
to check if property value is > 1 million
his income should be 50k
*/
$.validator.addMethod("btlpropertyexpression", function (value, element, param) {
var propertyLimit = Number(param[0]) ? Number(param[0]) : 0,
minIncome = Number(param[1]) ? Number(param[1]) : 0,
cur = $(element).closest('[data-currency]').attr('data-currency'),
incomeVal = $('[data-fbpof="income_details"] [data-target="income"] .aip-fbp-amount').text(),
jointIncomeVal = $('[data-fbpof="joint_income_details"] [data-target="income"] .aip-fbp-amount').text(),
isJointApplicant = $('.is-joint-applicant').length;
finalVal = true;
incomeVal = Number(globalUtil.replaceComma(incomeVal.replace(cur, '')));
jointIncomeVal = Number(globalUtil.replaceComma(jointIncomeVal.replace(cur, '')));
value = Number(globalUtil.replaceComma(value.replace(cur, '')));
if (value > propertyLimit) {
if (isJointApplicant) {
if (incomeVal < minIncome && jointIncomeVal < minIncome) {
finalVal = false;
}
} else {
if (incomeVal < minIncome) {
finalVal = false;
}
}
}
return this.optional(element) || finalVal;
});
//Validator method for LTV
$.validator.addMethod("ltv", function (value, element, param) {
var cur = $(element).closest('[data-currency]').attr('data-currency'),
propertyValue = $('[data-field-name*="propertyValue"]:visible .input-field').val(),
ltvVal, maxPropertyVal = 0;
if ($('.aip-page.aip-borrowing-details').length) {
propertyValue = $('.aip-page.aip-borrowing-details').find('[data-field-name*="propertyValue"]:visible .input-field').val();
}
value = value.replace(/,/g, "").replace(cur, '');
propertyValue = propertyValue.replace(/,/g, "").replace(cur, '');
ltvVal = 100 - ((value / propertyValue) * 100);
param = param.split(",");
for (i = 0; i < param.length; i++) {
maxPropertyVal = parseInt(param[i].substr(param[i].indexOf("}") + 3, param[i].length));
if (isNaN(parseInt(maxPropertyVal))) {
maxPropertyVal = parseInt(param[i].substr(param[i].indexOf("}") + 2, param[i].length));
}
var range = param[i].substr(param[i].indexOf("(") + 1, (param[i].indexOf(")") - param[i].indexOf("(") - 1));
range = range.split("-");
if (ltvVal <= range[0] && ltvVal > range[1]) {
if (value <= maxPropertyVal)
return true;
return false;
}
}
return false;
});
//42768: Validator method for aipmaxmortgage
$.validator.addMethod("aipmaxmortgage", function (value, element, param) {
var cur = $(element).closest('[data-currency]').attr('data-currency'),
propertyValue = $('[data-field-name*="propertyValue"]:visible .input-field').val(),
ltvVal, maxPropertyVal = 0,additionalOutORBorrow = '0',count=0;
if ($('.aip-page.aip-borrowing-details').length) {
propertyValue = $('.aip-page.aip-borrowing-details').find('[data-field-name*="propertyValue"]:visible .input-field').val();
}
value = value.replace(/,/g, "").replace(cur, '');
if($(element).closest('.aip-borrowings-textfield-additional-borrowing').length > 0 || $(element).closest('.aip-borrowings-textfield-amount-outstanding').length > 0) {
if($(element).closest('.aip-borrowings-textfield-additional-borrowing').length > 0){
additionalOutORBorrow = $('.aip-page.aip-borrowing-details').find('[data-field-name*="depositWorth"]:visible .input-field').val();
additionalOutORBorrow = additionalOutORBorrow.replace(/,/g, "").replace(cur, '');
}
value = parseInt(additionalOutORBorrow) + parseInt(value.replace(/,/g, "").replace(cur, ''));
}
propertyValue = propertyValue.replace(/,/g, "").replace(cur, '');
ltvVal = 100 - ((value / propertyValue) * 100);
if($(element).closest('.aip-borrowings-textfield-additional-borrowing').length > 0 || $('.aip-borrowings-textfield-amount-outstanding:visible').length > 0){
ltvVal = ((value / propertyValue) * 100);
}
if($('.aip-borrowings-textfield-amount-outstanding:visible').length > 0) {
minusDeposite = value;
} else {
minusDeposite = propertyValue - value;
}
param = param.split(",");
for (i = 0; i < param.length; i++) {
maxPropertyVal = parseInt(param[i].substr(param[i].indexOf("}") + 3, param[i].length));
if (isNaN(parseInt(maxPropertyVal))) {
maxPropertyVal = parseInt(param[i].substr(param[i].indexOf("}") + 2, param[i].length));
}
var range = param[i].substr(param[i].indexOf("(") + 1, (param[i].indexOf(")") - param[i].indexOf("(") - 1));
range = range.split("-");
if (ltvVal <= range[0] && ltvVal > range[1]) {
count++;
if (minusDeposite <= maxPropertyVal){
return true;
}
return false;
}
}
if(count==0){
return true;
}
return false;
});
//checkboxvaluecheck Validation validates check box.
$.validator.addMethod("checkboxvaluecheck", function (value, element, param) {
if ($(element).is(":checked")) {
if ((element.type === "checkbox") && param === value) {
return true;
}
return false;
} else {
return true;
}
});
//checkboxvaluecheck Validation validates check boxes.
$.validator.addMethod("chkyes", function (value, element, param) {
var isAnyCheckboxLeft = 0;
v = 0;
len = $("input[name=" + element.name + "]").length;
for (v; v < len; v++) {
if ($("input[name=" + element.name + "]:eq(" + v + ")").is(':checked') == false) {
isAnyCheckboxLeft += 1;
break;
}
}
return (isAnyCheckboxLeft == 0);
});
//Validator method for Account number
$.validator.addMethod("accountnumber", function (value, element, param) {
value = value.replace(/,/g, "");
var accountnumReg1 = /^([\d]{1,20}[\/\-\s]{1}[\d]{0,20})+$/,
accountnumReg2 = /^[\d]{1,30}$/;
return this.optional(element) || (accountnumReg1.test(value)) || (accountnumReg2.test(value));
});
//CWF forms char length checks for minimum chars and allows more
$.validator.addMethod("charlength", function (value, element, param) {
var stringToGoIntoTheRegex = param.toString();
var accountnumReg = new RegExp("^[\\w\\W]{" + stringToGoIntoTheRegex + ",}");
return this.optional(element) || (accountnumReg.test(value));
});
// CWF forms currency multiples validation
$.validator.addMethod("currencymultiples", function (value, element, param) {
return Math.round(value / param) / (1 / param) === Number(value);
});
//CWF forms Acccount Number Fixed length
$.validator.addMethod("fixedlength", function (value, element, param) {
var stringToGoIntoTheRegex = param.toString();
var accountnumReg = new RegExp("^[0-9]{" + stringToGoIntoTheRegex + "}$");
return this.optional(element) || (accountnumReg.test(value));
});
//Mortgage Acccount Number validation
$.validator.addMethod("mortgageaccountnumber", function (value, element, param) {
var accountnumReg = /^[1378]{1}\d{7}$/;
return this.optional(element) || (accountnumReg.test(value));
});
//Sort code 985 validation
$.validator.addMethod("sortcode985", function (value, element, param) {
var sortcodeReg = /^(98-){1}[56789]{1}\d{1}[-]{1}\d{2}$/;
return this.optional(element) || (sortcodeReg.test(value));
});
//Sort code 98 validation
$.validator.addMethod("sortcode98", function (value, element, param) {
var sortcodeReg = /^(98-){1}\d{2}[-]{1}\d{2}$/;
return this.optional(element) || (sortcodeReg.test(value));
});
//Validation method for sort code
$.validator.addMethod("sortcode", function (value, element, param) {
value = value.replace(/,/g, "");
var sortCodeRegex = /^\d\d[-]\d\d[-]\d\d$/,
numberRegex = /^\d\d\d\d\d\d$/;
if (sortCodeRegex.test(value)) {
return this.optional(element) || true;
} else if (numberRegex.test(value)) {
element.value = element.value.substring(0, 2) + "-" + element.value.substring(2, 4) + "-" + element.value.substring(4, 6);
return this.optional(element) || true;
} else {
return false;
}
});
//Validation method for post code
$.validator.addMethod("postcode", function (value, element, param) {
return true;
});
//Validation method for Natyes Postcode Exclude
$.validator.addMethod("excludepostcode", function (value, element, param) {
value = value.toLowerCase();
param = param.toLowerCase();
var exPostcode = param.split(",");
for (var i = 0; i < exPostcode.length; i++) {
if (value.indexOf(exPostcode[i]) == 0) {
return false;
}
}
return true;
});
//Validation method for Natyes Postcode Include
$.validator.addMethod("includepostcode", function (value, element, param) {
value = value.toLowerCase();
param = param.toLowerCase();
var inPostcode = param.split(",");
for (var i = 0; i < inPostcode.length; i++) {
if (value.indexOf(inPostcode[i]) == 0) {
return true;
}
}
return false;
});
//Validation method for DD of the Month
$.validator.addMethod("ddofthemonth", function (value, element, param) {
value = value.substring(0, 2);
if (value >= 0) {
return true;
} else {
return false;
}
});
// Validation Method to check hyphen and underscore in textfield
$.validator.addMethod("charvalidation", function (value, element, param) {
var valid = false;
if (value.length != 0) {
value = value.replace(/,/g, "");
var pattern = /^[A-Za-z0-9 _-\s]*[A-Za-z0-9\s][A-Za-z0-9 _-\s]*$/;
valid = pattern.test(value);
}
return valid;
});
// Validation Method to DOB for min age(od)
$.validator.addMethod("minage", function (value, element, param) {
var valid = false,
startDateRev = value.split("/").reverse().join("-"),
age = param,
differnceAge = new Date(new Date() - new Date(startDateRev)).getFullYear() - 1970;
if (differnceAge >= age && (startDateRev.indexOf('0') !== 0)) {
valid = true;
}
return valid;
});
// Validation Method to DOB for max age(od)
$.validator.addMethod("maxage", function (value, element, param) {
var valid = false,
startDateRev = value.split("/").reverse().join("-"),
age = param,
differnceAge = new Date(new Date() - new Date(startDateRev)).getFullYear() - 1970;
if (differnceAge <= age && (startDateRev.indexOf('0') !== 0)) {
valid = true;
}
return valid;
});
// Validation Method for maximum value
$.validator.addMethod("maxchars", function (value, element, param) {
var strlength = value.length;
return strlength <= param;
});
//validation for mobile number || Start with 0 or +44
$.validator.addMethod('mobilevalidation', function (value, element, param) {
var valid, mobilenumber = value.toString(),
mblength = mobilenumber.length,
minlength = 11,
maxlength = 15;
if (mblength != 0) {
if ((mblength >= minlength && mblength <= maxlength) && (mobilenumber.indexOf('0') == 0 || mobilenumber.indexOf('44') == 0)) {
valid = true;
}
} else {
valid = true;
}
return valid;
});
//validation for Sar date range
$.validator.addMethod("sardaterange", function (value, element, param) {
var valid = false,
startDateRev = param.split("/").reverse().join("-"),
endDateRev = value.split("/").reverse().join("-");
if (new Date(endDateRev).getTime() >= new Date(startDateRev).getTime()) {
valid = true;
}
return valid;
});
//validation for currentdate
$.validator.addMethod("currentdate", function (value, element, param) {
var valid = false,
endDateRev = value.split("/").reverse().join("-");
if (new Date(endDateRev).getTime() <= new Date().getTime()) {
valid = true;
}
return valid;
});
// Validation Method for email value
$.validator.addMethod("emailvalidation", function (value, element, param) {
var valid = false;
if (value.length != 0) {
value = value.replace(/,/g, "");
var pattern = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
valid = value.match(pattern);
}
return value.match(pattern);
});
// Validation Method for confirm email value
$.validator.addMethod("confirmemail", function (value, element, param) {
var valid = false,
emailvalue = $('input[name="' + param + '"]').val();
if (value.length != 0) {
value = value.replace(/,/g, "");
var pattern = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if (pattern.test(value)) {
if (value.toLowerCase() == emailvalue.toLowerCase()) {
valid = true;
}
}
}
if (value.length == 0 && emailvalue.length == 0) {
valid = true;
}
return valid;
});
//validation method for aipemailvalidation-44069
$.validator.addMethod("aipemailvalidation", function (value, element, param) { //value is the current input value, param value is the element name of comparing Email input
var valid = true,
emailvalue = $('input[name="' + param + '"]').val();
if (value.length != 0 && emailvalue.length != 0) {
value = value.replace(/,/g, "");
emailvalue = emailvalue.replace(/,/g, "");
if (value.toLowerCase() == emailvalue.toLowerCase()) {
valid = false;
}
}
return valid;
});
//validation for todatefromdate
$.validator.addMethod("todatefromdate", function (value, element, param) {
var valid = false,
startDateRev = param.split("/").reverse().join("/"),
endDateRev = value.split("/").reverse().join("/");
var elementfrom = $(element).closest('.product-to-date'),
elementValue = $(elementfrom).prev().find('input.input-date').val(),
elementValueRev = elementValue.split("/").reverse().join("/");
if (new Date(endDateRev) > new Date(elementValueRev)) {
valid = true;
}
return valid;
});
// Validation Method to check if name contains atleast 1 alpha character.
$.validator.addMethod("sarnamevalidation", function (value, element, param) {
var valid = false;
if (value.length != 0) {
value = value.replace(/,/g, "");
var pattern = /^(?=.*?[A-Za-z])/;
valid = pattern.test(value);
}
return valid;
});
//Validation method for rd mobile number
$.validator.addMethod("rdmobilenumber", function (value, element, param) {
var valid = false;
element.value = value.replace(/\s{2,}/g, " ");
if (element.value.length != 0) {
var pattern = /^[+]?\s?[0-9_ \s]{1,25}$/;
valid = pattern.test(element.value);
return this.optional(element) || valid;
}
});
//Validation method for aipmobilenumbervalidation-44069
$.validator.addMethod("aipmobilenumbervalidation", function (value, element, param) { //value is the current input value, param value is the element name of comparing Mobile input
var valid = false;
mobilevalue = $('input[name="' + param + '"]').val();
if (element.value.length != 0) {
element.value = value.replace(/\s{2,}/g, " ");
var pattern = /^[+]?\s?[0-9_ \s]{1,25}$/;
if(pattern.test(element.value)){
if(value != mobilevalue){
valid = true;
}
}
}
return valid;
});
// Validation Method to rd name validations
$.validator.addMethod("rdnamevalidation", function (value, element, param) {
var valid = false;
if (value.length != 0) {
value = value.replace(/,/g, "");
var pattern = /^[A-Za-z0-9 _-\s']*[A-Za-z0-9\s][A-Za-z0-9 _-\s']*$/;
valid = pattern.test(value);
}
return valid;
});
// Validation Method to rd special characters restriction
$.validator.addMethod("rdspecialcharacters", function (value, element, param) {
var valid = false;
if (value.length != 0) {
var pattern = /[%;<=>^|£]/;
valid = pattern.test(value);
}
return !valid;
});
// validation for rddatelimit
$.validator.addMethod("rddatelimit", function (value, element, param) {
var valid = false,
currentElementDate = $(element).val().split("/");
if (currentElementDate[2] != '0000') {
valid = true;
}
return valid;
});
$.validator.addMethod("rddate", function (value, element, param) {
var valid = false;
if ($(element).parents('.rd__input--date').prevAll('.rd__input--date:first').find('input[type="text"]').length != 0) {
var prevElementDate = $(element).parents('.rd__input--date').prevAll('.rd__input--date:first').find('input[type="text"]').val().split("/").reverse().join("-");
} else {
prevElementDate = $(element).parents('.rdparsys').find('input[name^="transactionDate"]:not(input[type="hidden"])').val().split("/").reverse().join("-");
}
CurrentElementDate = $(element).val().split("/").reverse().join("-");
if (new Date(CurrentElementDate).getTime() >= new Date(prevElementDate).getTime()) {
valid = true;
}
return valid;
});
$.validator.addMethod("rdEndDate", function (value, element, param) {
var valid = false,
CurrentElementDate = $(element).val().split("/").reverse().join("-"),
prevElementDate = $(element).parents('.rd__input--date').prevAll('.rd__input--date:first').find('input[type="text"]').val().split("/").reverse().join("-");
if (prevElementDate != "" && CurrentElementDate != "" && new Date(CurrentElementDate).getTime() >= new Date(prevElementDate).getTime()) {
valid = true;
} else if (CurrentElementDate == "") {
valid = true;
}
return valid;
});
// validation for rd cancel date
$.validator.addMethod("rdcanceldate", function (value, element, param) {
var dateObj = [],
valid = false,
elementName = $(element).attr('name');
$('.rd__input--date input[type="text"]:not(input[name=' + elementName + '])').each(function () {
var dateValue = $(this).val().split("/").reverse().join("-");
dateObj.push(dateValue)
});
var sorted = dateObj.slice().sort(function (a, b) {
return new Date(a) - new Date(b);
});
var smallDate = sorted.shift();
smallElementDate = smallDate,
CurrentElementDate = $(element).val().split("/").reverse().join("-");
if (new Date(CurrentElementDate).getTime() <= new Date(smallElementDate).getTime()) {
valid = true;
}
return valid;
});
//validation for rd currency exchange field upto 10 decimals
$.validator.addMethod("rdcurrencyexchange", function (value, element, param) {
var valid = false;
var amount = element.value;
if (element.value.length != 0) {
var pattern = /^\d*([,]?\d{0,2})+\.?\d{0,10}$/;
valid = pattern.test(amount);
return this.optional(element) || valid;
}
});
// Validation Method to check greaterthanmin value
$.validator.addMethod("greaterthanmin", function (value, element, param) {
var valid = false,
currencySymbol = $(".equity_calculator ").attr("data-currency"),
minValue = $(".home-value-min-textbox .text-field-comp input").val().replace(currencySymbol, '').replace(/\,/g, '');
value = value.replace(currencySymbol, '').replace(/\,/g, '');
if (Number(value) > Number(minValue)) {
valid = true;
}
return valid;
});
// validation for rd disputed amount some of it amount
$.validator.addMethod("rddisputeamount", function (value, element, param) {
var valid = false,
currentAmount = $(element).val().slice(1),
parentAmount = $(element).parents('.rdparsys').find('input[name^="transactionAmount"]').val();
if (currentAmount != '0' && parentAmount != '£0' && Number(currentAmount.replace(/\,/g, '')) < Number(parentAmount.slice(1).replace(/\,/g, ''))) {
valid = true;
}
if (parentAmount == '') {
valid = true;
}
return valid;
});
$.validator.addMethod("rddecimal", function (value, element, param) {
var valid = false;
var amount = element.value.slice(1);
if (element.value.length != 0) {
var pattern = /^\d*([,]?\d{0,2})+\.?\d{1,2}$/;
valid = pattern.test(amount);
return this.optional(element) || valid;
}
});
//Validation method for AddressCheck
$.validator.addMethod("addresscheck", function (value, element, param) {
var addressCheckFields = $(element).closest('.address-manual-entry').find("[data-constraint*='addresscheck']").parent().find('.input-field'),
valid = false,
enableaddresscheckcrm = addressCheckFields.closest('.crm-form-address-finder-wrap').attr('data-enableaddresscheck'),
enableaddresscheck = addressCheckFields.closest('.mortgage-address-finder-wrap').attr('data-enableaddresscheck');
if (enableaddresscheckcrm || enableaddresscheck) {
$.each(addressCheckFields, function () {
if ($(this).val() != "") {
valid = true;
}
});
if (valid) {
$.each(addressCheckFields, function () {
if ($(this).val() == "") {
$(this).attr('isvalid', 'true').closest('.row').removeClass('errorState');
}
});
} else {
$.each(addressCheckFields, function () {
$(this).attr('isvalid', 'false').closest('.row').addClass('errorState');
var errMsg = IDM.validationMsgs[$(this).attr("name")].addresscheck,
errObject = {
"html": function () {
return errMsg;
}
}
IDM.errorPlacement(errObject, $(this));
});
}
return valid;
} else {
return true;
}
});
//NoValid range method for PBBASB-38087
$.validator.addMethod("novalidrange", function (value, element, param) {
if (typeof param === 'string' && param.indexOf('[') >= 0) {
param = JSON.parse(param);
}
var cur;
if ($(element).closest("[data-currency]").length > 0) {
cur = $(element)
.closest("[data-currency]")
.attr("data-currency");
} else {
cur = $(element).attr("placeholder");
}
if ($(element).hasClass('input-currency') || (value.indexOf(cur) >= 0)) {
if (value.indexOf(cur) >= 0) {
value = value.replace(cur, "").trim();
}
value = parseInt(value.replace(/,/g, ""));
}
if ($(element).hasClass('input-percentage')) {
if (value.indexOf('%') >= 0) {
value = value.replace('%', "");
}
}
return this.optional(element) || ((value >= param[0] && value <= param[1]) == true) ? false : true;
});
//validation method for aipsortcode
$.validator.addMethod("aipsortcodeandaccnumber", function (value, element, param) {
value = value.replace(/,/g, "").replace(/-/g, ""); //sortcode value to be sent in ajax call
var accNo = Parser.evaluate(populate(param)).toString(), //account no to be sent in ajax call
mainData, errorText, elementName = $(element).attr("name"),
$inputError = $(element).closest('.row').parent().find("[data-constraint*='aipsortcodeandaccnumber']"),
constrainttype = $inputError.data("constraint"),
$sortcodeError = $(element).closest('.row').find('#sortcodeError'),
accElementName = $inputError.parent().prev().find(".row").find(".input-field"),
formValid = $(element).closest("form").validate(),
isValid = false,
accountNumberCheck = function (status) {
$("html,body").animate({
scrollTop: $(accElementName).offset().top
}, 250);
$(accElementName).off("blur.accBlur").on("blur.accBlur", function () {
if (value != "") {
$(accElementName).closest(".row").removeClass("focus");
$(element).blur();
}
});
$(accElementName).off("keydown.keyCheck").on("keydown.keyCheck", function () {
if (value != "") {
if (status) {
$(element).closest(".row").removeClass("errorState");
}
}
});
};
constrainttype = constrainttype.split("|")[0];
mainData = JSON.stringify({
key: "ba3bf-bad51-a4bfe-00d09",
sortCode: value,
accountNumber: accNo
});
$.ajax({
type: "POST",
url: "https://api.craftyclicks.co.uk/bank/1.1/validate",
async: false,
data: mainData,
dataType: "json",
contentType: "application/json",
success: function (response) {
if (response.successful) {
if ($sortcodeError.length) {
$sortcodeError.remove();
}
if (response.bankValidate.sortCodeListed === false && response.bankValidate.invalidAccountNumber === true) {
//here comes the both sort code and account number error field
errorText = $inputError.data("message");
$(accElementName).closest(".row").addClass("errorState");
$(accElementName).attr("isValid", "false");
IDM.validationMsgs[elementName][constrainttype] = errorText;
formValid.settings.messages[elementName][constrainttype] = errorText;
errObj = {
"html": function () {
return errorText;
}
}
IDM.errorPlacement(errObj, element);
IDM.errorPlacement(errObj, accElementName);
accountNumberCheck(false);
isValid = false;
} else if (response.bankValidate.sortCodeListed === false) {
if ($(accElementName).closest(".row").hasClass("errorState")) {
$(accElementName).attr("isValid", "true").closest(".row").removeClass("errorState");
}
//here comes the sort code error field
errorText = $inputError.data("sortcodemessage");
IDM.validationMsgs[elementName][constrainttype] = errorText;
formValid.settings.messages[elementName][constrainttype] = errorText;
errObj = {
"html": function () {
return errorText;
}
}
IDM.errorPlacement(errObj, element);
isValid = false;
} else if (response.bankValidate.invalidAccountNumber) {
//here comes account number error field
errorText = $inputError.data("accountnomessage");
$(accElementName).closest(".row").addClass("errorState");
$(accElementName).attr("isValid", "false");
IDM.validationMsgs[elementName][constrainttype] = errorText;
formValid.settings.messages[elementName][constrainttype] = errorText;
errObj = {
"html": function () {
return errorText;
}
}
IDM.errorPlacement(errObj, element);
IDM.errorPlacement(errObj, accElementName);
accountNumberCheck(true);
isValid = false;
} else {
if ($(accElementName).closest(".row").hasClass("errorState")) {
$(accElementName).attr("isValid", "true").closest(".row").removeClass("errorState");
}
isValid = true;
}
} else {
isValid = true;
}
},
error: function () {
if (!$sortcodeError.length) {
$(element).closest('.row').append("the sortcode api failed
");
}
isValid = true;
},
});
return isValid;
});
//Allow only letters & special characters - CCP Tool
$.validator.addMethod("ccpalphaspecialchars", function (value, element, param) {
let reg = /^[a-zA-Z!`@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~ ]+$/;
return (value.trim().length > 0) ? this.optional(element) || (reg.test(value)) : true;
});
//Allow numbers & special characters - CCP Tool
$.validator.addMethod("ccpnumberspecialchars", function (value, element, param) {
let reg = /^[0-9#()+ -]+$/;
return (value.trim().length > 0) ? this.optional(element) || (reg.test(value)) : true;
});
//validation for PAN - PBBASB-12549
$.validator.addMethod("rdpannumber", function (value, element, param) {
var valid = false,
pan = element.value,
$panrow = $(element).closest('.row');
if (pan.length != 0 && pan.length == 16) {
var panConsumerBins = $panrow.find('.binnumbers.consumer').text(),
panConsumerBinArray = panConsumerBins ? panConsumerBins.trim().replace(/\s/g, '').split(',') : [],
panCommercialBins = $panrow.find('.binnumbers.commercial').text(),
panCommercialBinArray = panCommercialBins ? panCommercialBins.trim().replace(/\s/g, '').split(',') : [],
firstSixCars = pan.substr(0, 6),isBinFound;
if (panConsumerBinArray.indexOf(firstSixCars) != -1) {
isBinFound = true;
$panrow.addClass('consumerCard').removeClass('commercialCard');
} else if (panCommercialBinArray.indexOf(firstSixCars) != -1){
isBinFound = true;
$panrow.addClass('commercialCard').removeClass('consumerCard');
} else {
isBinFound = false;
$panrow.removeClass('consumerCard commercialCard');
}
return isBinFound ? true : false;
} else {
return false;
}
});
//validation for Phone number using E.164 format PBASB-25629
$.validator.addMethod("countryPhnNum", function (value, element, param) {
var phoneNum, countryCodeDropdown, valid, completPhnNum, countryCodeRegex, newPhoneNmber;
countryCodeRegex= /^\+[1-9]\d{1,14}$/;
phoneNumberStartWithNoZero = /^[1-9][0-9]*/;
phoneNum = $(element).val();
newPhoneNmber = true;
countryCodeDropdown = $(element).closest(".templateselection__numinput").siblings(".templateselection__countrydropdown").find("option:selected").val();
if((countryCodeDropdown == '+44') || (countryCodeDropdown == '+91')){
newPhoneNmber = phoneNumberStartWithNoZero.test(phoneNum);
}
completPhnNum = countryCodeDropdown + phoneNum;
valid = countryCodeRegex.test(completPhnNum) && newPhoneNmber;
return ((!valid) ? false : true);
});
//Validation for regular expression constraint in CRM form PBASB-27434
$.validator.addMethod("crmregularexpression", function (value, element, param) {
var regExpressionValue, crmInputFieldsValue, valid, checkRegExpressionValue;
regExpressionValue = param;
crmInputFieldsValue = $(element).val();
checkRegExpressionValue = regExpressionValue instanceof RegExp;
if(checkRegExpressionValue == true && !crmInputFieldsValue == ""){
valid = regExpressionValue.test(crmInputFieldsValue);
return ((!valid) ? false : true);
}
else{
return valid = true;
}
});
IDM.errorPlacement = function (error, element, errorMethod) {
var errorMsg = error.html(),
$errorContainer = $(element).closest('.row'),
randomID = Math.random().toString().split('.')[1],
$errorHtml = '' +
'
' +
' ' +
'' + errorMsg + ' '
'
';
if ($errorContainer.find('.error-container').length > 0) {
$errorContainer.find('.error-container .error-text').html(errorMsg);
} else {
$errorContainer.append($errorHtml);
}
$errorContainer.addClass('errorState');
$errorContainer.find('.error-container').slideDown(400);
fnSetDescribedByID($(element), 'set');
};
//IDM.form = $('#main-content-wrapper form');
}(jQuery));
IDM.validationUtils = (function ($) {
function _validationUtils() {
var formData = {},
validationSettings = {},
nextButton = function (element) {
if ((!$('.overdraftpay').length && !$('.email_template_wrapper').length && !$('.early-calculator').length && !($('.loan_calculator').length) && !$('.odcc_wrapper').length && !$('.eufx-calculator').length) && ($('html').hasClass('msie') || $('html').hasClass('msedge'))) {
setTimeout(function () {
innerFn();
}, 500);
} else {
innerFn();
}
function innerFn() {
var isValid,
$form = $(element).closest("form"),
name = $(element).attr("name"),
elm = $(element).attr("isValid"),
elmVal = $(element).attr("isValidAmt");
if (elm !== undefined) {
if (!elmVal || elmVal === "true") {
isValid = $(element).valid();
} else {
isValid = false;
}
$targetEle = $form.find('[name="' + name + '"]');
if (isValid == 1) {
$targetEle
.attr("isValid", true)
.removeClass("error")
.closest(".row")
.removeClass("errorState")
.end();
fnSetDescribedByID($targetEle, 'reset');
} else {
$targetEle
.attr("isValid", false)
.addClass("error")
.closest(".row")
.addClass("errorState")
.end();
fnSetDescribedByID($targetEle, 'set');
}
} else {
return;
}
}
};
//this assigns your default values
(defaultsSettings = {
onkeyup: false,
onsubmit: false,
debug: true,
rules: IDM.validationRules,
messages: IDM.validationMsgs,
errorPlacement: IDM.errorPlacement,
ignore: ".ignore, :hidden",
onfocusout: function (element) {
if(!$(element).hasClass("multiselect-dropdown")){
element.value = $.trim(element.value);
}
if (
$(element).hasClass("input-percentage") &&
element.value.length >= 1
) {
if (
!isNaN(element.value) &&
element.value.indexOf("%") < 0 &&
Number(element.value) >= 0
) {
element.value = element.value + "%";
}
}
if (
$(element).hasClass("input-currency") &&
element.value.length >= 1
) {
var cur = $(element)
.closest("[data-currency]")
.attr("data-currency");
if (
!isNaN(element.value) &&
element.value.indexOf(cur) < 0 &&
Number(element.value) >= 0
) {
element.value = cur + globalUtil.formatNumber(element.value);
}
}
if (
$(element)
.closest(".form-field-wrap,.cc-purchase-interest-row")
.hasClass("focussed")
) {
$(element)
.closest(".form-field-wrap,.cc-purchase-interest-row")
.removeClass("focussed");
}
if (
!$(element).hasClass("error") &&
$(element)
.closest(".form-field-wrap")
.hasClass("errorState")
) {
$(element)
.closest(".form-field-wrap")
.removeClass("errorState");
fnSetDescribedByID($(element), 'reset');
}
nextButton(element);
},
onkeydown: function (element, e) {
if (
$(element).hasClass("number-integer") ||
$(element).hasClass("input-currency") ||
$(element).hasClass("input-percentage")
) {
var key = e.charCode || e.keyCode || 0;
// allow backspace, tab, delete, arrows, numbers and keypad numbers ONLY
if (
key == 8 ||
key == 9 ||
key == 46 ||
(key >= 35 && key <= 40) ||
(key >= 48 && key <= 57) ||
(key >= 96 && key <= 105)
) {
return;
} else {
e.preventDefault();
}
}
},
unhighlight: function (element, errorClass, validClass) {
var checkErrElm = $(element)
.parents(".form-field-wrap")
.first()
.find(".error-container");
$(checkErrElm)
.parent()
.remove();
$(element).removeClass("error_text");
}
}),
(defaults = {
form: '',
ajaxSubmit: true,
ajaxSubmitType: "POST",
ajaxFormat: "json",
onSubmitSuccessCallback: null,
onSubmitErrorCallback: null,
onSubmitClick: null,
onBeforeSubmit: null
});
var initValidations = function () {
$(formData.form).validate(validationSettings);
};
this.localizeAndValidate = function (scriptOptions) {
var $forms = $('#main-content-wrapper form');
if($('.ccp-constrains').length){
var $forms = $('.ccp-constrains form');
};
if($('.budgetcalc-tool-parent').length){
var $forms = $('.budgetcalc-tool-parent form');
};
if($('.common-form-container').length){
var $forms = $('.common-form-container form');
};
if($('.common-form-container').length){
var $forms = $('.common-form-container form');
};
if ($forms.length) {
if ($forms.length > 1) {
$.each($forms, function () {
defaults.form = $(this);
formData = $.extend({}, defaults, scriptOptions);
validationSettings = defaultsSettings;
initValidations();
});
} else {
IDM.form = $forms;
defaults.form = IDM.form;
formData = $.extend({}, defaults, scriptOptions);
validationSettings = defaultsSettings;
initValidations();
}
}
};
this.isFieldsetValid = function (element) {
return $(element).valid();
};
return this;
}
return new _validationUtils();
})(jQuery);
(function ($) {
IDM.validationUtils.localizeAndValidate();
})(jQuery);
});
function scrolltop(){
if ($(this).scrollTop() > 1500) {
$('.scrolltotop').fadeIn();
} else {
$('.scrolltotop').fadeOut();
}
}
$(document).ready(function () {
if ($('.scrolltotop').length) {
scrolltop();
$(window).scroll(function () {
scrolltop();
if ($(this).scrollTop() + $('.ia__footer--responsive').outerHeight() > $('.ia__footer--responsive').offset().top)
{
$('.scrolltotop').css('bottom','200px');
}
else
{
$('.scrolltotop').css('bottom','');
}
})
$('.scrolltotop').on('click', function () {
$('html, body').animate({
scrollTop: 0
}, 700);
return false;
})
}
})